bug fixed: [1858892] The Foreign Keys of these tables have been reordered, future exports will not reorder them
authorAntonio Moreno <antonio.moreno@openbravo.com>
Mon, 11 Feb 2008 14:32:48 +0000
changeset 410 ec5115414c8c
parent 409 8a6648a58e66
child 411 dc1ef23afa0b
bug fixed: [1858892] The Foreign Keys of these tables have been reordered, future exports will not reorder them
database/model/tables/AD_ATTRIBUTE.xml
database/model/tables/AD_CLIENTINFO.xml
database/model/tables/AD_COLUMN.xml
database/model/tables/AD_ELEMENT_TRL.xml
database/model/tables/AD_FIELD.xml
database/model/tables/AD_FIELD_TRL.xml
database/model/tables/AD_MENU.xml
database/model/tables/AD_MENU_TRL.xml
database/model/tables/AD_MESSAGE_TRL.xml
database/model/tables/AD_MODEL_OBJECT.xml
database/model/tables/AD_ORGINFO.xml
database/model/tables/AD_PRINTFORMAT.xml
database/model/tables/AD_PRINTGRAPH.xml
database/model/tables/AD_PROCESS_ACCESS.xml
database/model/tables/AD_PROCESS_PARA.xml
database/model/tables/AD_PROCESS_TRL.xml
database/model/tables/AD_REFERENCE_TRL.xml
database/model/tables/AD_REF_LIST_TRL.xml
database/model/tables/AD_REF_TABLE.xml
database/model/tables/AD_ROLE.xml
database/model/tables/AD_SEQUENCE_AUDIT.xml
database/model/tables/AD_TAB.xml
database/model/tables/AD_TABLE_ACCESS.xml
database/model/tables/AD_TAB_TRL.xml
database/model/tables/AD_TASK_ACCESS.xml
database/model/tables/AD_TASK_TRL.xml
database/model/tables/AD_TEXTINTERFACES_TRL.xml
database/model/tables/AD_USER.xml
database/model/tables/AD_USERDEF_WIN.xml
database/model/tables/AD_USER_ROLES.xml
database/model/tables/AD_WF_NODE_TRL.xml
database/model/tables/AD_WINDOW_ACCESS.xml
database/model/tables/AD_WINDOW_TRL.xml
database/model/tables/AD_WORKFLOW_ACCESS.xml
database/model/tables/AD_WORKFLOW_TRL.xml
database/model/tables/AT_COMMAND.xml
database/model/tables/AT_COMMAND_TRL.xml
database/model/tables/AT_LINE.xml
database/model/tables/AT_TEST.xml
database/model/tables/AT_TESTDOCUMENT.xml
database/model/tables/AT_TESTDOCUMENTLINE.xml
database/model/tables/A_AMORTIZATION.xml
database/model/tables/A_AMORTIZATIONLINE.xml
database/model/tables/A_ASSET.xml
database/model/tables/C_ACCTSCHEMA.xml
database/model/tables/C_ACCTSCHEMA_DEFAULT.xml
database/model/tables/C_ACCTSCHEMA_ELEMENT.xml
database/model/tables/C_APPROVAL.xml
database/model/tables/C_BPARTNER.xml
database/model/tables/C_BPARTNER_LOCATION.xml
database/model/tables/C_BP_GROUP_ACCT.xml
database/model/tables/C_BP_VENDOR_ACCT.xml
database/model/tables/C_BUDGETLINE.xml
database/model/tables/C_CITY.xml
database/model/tables/C_COMMISSION.xml
database/model/tables/C_COMMISSIONLINE.xml
database/model/tables/C_COMMISSIONRUN.xml
database/model/tables/C_CONVERSION_RATE.xml
database/model/tables/C_COUNTRY.xml
database/model/tables/C_COUNTRY_TRL.xml
database/model/tables/C_CURRENCY_TRL.xml
database/model/tables/C_DEBT_PAYMENT.xml
database/model/tables/C_DISCOUNT.xml
database/model/tables/C_DOCTYPE.xml
database/model/tables/C_DOCTYPE_TRL.xml
database/model/tables/C_DUNNING.xml
database/model/tables/C_ELEMENT.xml
database/model/tables/C_ELEMENTVALUE.xml
database/model/tables/C_GREETING.xml
database/model/tables/C_GREETING_TRL.xml
database/model/tables/C_INTERORG_ACCT.xml
database/model/tables/C_INVOICE.xml
database/model/tables/C_INVOICELINE.xml
database/model/tables/C_LOCATION.xml
database/model/tables/C_NATION.xml
database/model/tables/C_ORDER.xml
database/model/tables/C_ORDERLINE.xml
database/model/tables/C_PAYMENTTERM.xml
database/model/tables/C_PAYMENTTERMLINE.xml
database/model/tables/C_PROJECT.xml
database/model/tables/C_PROJECTLINE.xml
database/model/tables/C_PROJECTPROPOSAL.xml
database/model/tables/C_PROJECT_ACCT.xml
database/model/tables/C_REGION.xml
database/model/tables/C_REMITTANCE_TYPE.xml
database/model/tables/C_SERVICELEVEL.xml
database/model/tables/C_SETTLEMENT.xml
database/model/tables/C_TAX.xml
database/model/tables/C_UOM_CONVERSION.xml
database/model/tables/C_VALIDCOMBINATION.xml
database/model/tables/C_WITHHOLDING.xml
database/model/tables/FACT_ACCT.xml
database/model/tables/FACT_ACCT_BALANCE.xml
database/model/tables/GL_JOURNAL.xml
database/model/tables/GL_JOURNALBATCH.xml
database/model/tables/GL_JOURNALLINE.xml
database/model/tables/I_BANKSTATEMENT.xml
database/model/tables/I_BPARTNER.xml
database/model/tables/I_BUDGETLINE.xml
database/model/tables/I_ELEMENTVALUE.xml
database/model/tables/I_GLJOURNAL.xml
database/model/tables/I_INVENTORY.xml
database/model/tables/I_INVOICE.xml
database/model/tables/I_ORDER.xml
database/model/tables/I_PRODUCT.xml
database/model/tables/I_REPORTLINE.xml
database/model/tables/I_TAX.xml
database/model/tables/K_ENTRYCATEGORY.xml
database/model/tables/MA_CALCSTD.xml
database/model/tables/MA_CCP.xml
database/model/tables/MA_CCP_GROUP.xml
database/model/tables/MA_CCP_SHIFT.xml
database/model/tables/MA_CONSUMEPRODUCT.xml
database/model/tables/MA_CONSUMERM.xml
database/model/tables/MA_COSTCENTER.xml
database/model/tables/MA_COSTCENTER_VERSION.xml
database/model/tables/MA_DEFAULTPLAN.xml
database/model/tables/MA_GLOBALUSE.xml
database/model/tables/MA_INCIDENCE.xml
database/model/tables/MA_INDIRECT_COST.xml
database/model/tables/MA_INDIRECT_COST_VALUE.xml
database/model/tables/MA_MACHINE.xml
database/model/tables/MA_MACHINESTATION.xml
database/model/tables/MA_MACHINE_TYPE.xml
database/model/tables/MA_MAINTENANCE.xml
database/model/tables/MA_MAINT_OPERATION.xml
database/model/tables/MA_MAINT_PART.xml
database/model/tables/MA_MAINT_PERIODICITY.xml
database/model/tables/MA_MAINT_SCHEDULED.xml
database/model/tables/MA_MAINT_WORKER.xml
database/model/tables/MA_MEASURE_GROUP.xml
database/model/tables/MA_MEASURE_SHIFT.xml
database/model/tables/MA_MEASURE_TIME.xml
database/model/tables/MA_MEASURE_VALUES.xml
database/model/tables/MA_PC_CASE.xml
database/model/tables/MA_PC_TEST.xml
database/model/tables/MA_PERIODIC_CONTROL.xml
database/model/tables/MA_PROCESS.xml
database/model/tables/MA_PROCESSPLAN.xml
database/model/tables/MA_PROCESSPLAN_VERSION.xml
database/model/tables/MA_PRODUCTTYPE.xml
database/model/tables/MA_SECTION.xml
database/model/tables/MA_SEQUENCE.xml
database/model/tables/MA_SEQUENCEPRODUCT.xml
database/model/tables/MA_SEQUENCEPRODUCT_COST.xml
database/model/tables/MA_TOOLSET.xml
database/model/tables/MA_TOOLSETPROCESS.xml
database/model/tables/MA_TOOLSETUSED.xml
database/model/tables/MA_TOOLSET_TYPE.xml
database/model/tables/MA_WEEMPLOYEE.xml
database/model/tables/MA_WEINCIDENCE.xml
database/model/tables/MA_WETECHNICALSUPPORT.xml
database/model/tables/MA_WORKREQUIREMENT.xml
database/model/tables/MA_WORKSTATION.xml
database/model/tables/MA_WRPHASE.xml
database/model/tables/MA_WRPHASEPRODUCT.xml
database/model/tables/MRP_RUN_PRODUCTION.xml
database/model/tables/MRP_RUN_PRODUCTIONLINE.xml
database/model/tables/MRP_RUN_PURCHASE.xml
database/model/tables/MRP_RUN_PURCHASELINE.xml
database/model/tables/MRP_SALESFORECASTLINE.xml
database/model/tables/M_ATTRIBUTEINSTANCE.xml
database/model/tables/M_ATTRIBUTEUSE.xml
database/model/tables/M_COSTING.xml
database/model/tables/M_FREIGHT.xml
database/model/tables/M_INOUT.xml
database/model/tables/M_INOUTLINE.xml
database/model/tables/M_INTERNAL_CONSUMPTION.xml
database/model/tables/M_INTERNAL_CONSUMPTIONLINE.xml
database/model/tables/M_INVENTORYLINE.xml
database/model/tables/M_LOCATOR.xml
database/model/tables/M_MOVEMENTLINE.xml
database/model/tables/M_OFFER_PRICELIST.xml
database/model/tables/M_PRICELIST.xml
database/model/tables/M_PRICELIST_VERSION.xml
database/model/tables/M_PRODUCT.xml
database/model/tables/M_PRODUCTIONLINE.xml
database/model/tables/M_PRODUCTIONPLAN.xml
database/model/tables/M_PRODUCT_PO.xml
database/model/tables/M_STORAGE_DETAIL.xml
database/model/tables/M_STORAGE_PENDING.xml
database/model/tables/M_SUBSTITUTE.xml
database/model/tables/M_TRANSACTION.xml
database/model/tables/PA_GOAL.xml
database/model/tables/PA_MEASURE.xml
database/model/tables/PA_REPORTCOLUMN.xml
database/model/tables/PA_REPORTLINE.xml
database/model/tables/R_REQUEST.xml
database/model/tables/S_TIMEEXPENSELINE.xml
--- a/database/model/tables/AD_ATTRIBUTE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_ATTRIBUTE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -38,12 +38,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADATTRIBUTE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_REFERENCE" name="ADREFERENCE_ADATTRIBUTE">
+        <reference local="AD_REFERENCE_ID" foreign="AD_REFERENCE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_REFERENCE" name="ADREFERENCEVALUE_ADATTRIBUTE">
         <reference local="AD_REFERENCE_VALUE_ID" foreign="AD_REFERENCE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_REFERENCE" name="ADREFERENCE_ADATTRIBUTE">
-        <reference local="AD_REFERENCE_ID" foreign="AD_REFERENCE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_TABLE" name="ADTABLE_ADATTRIBUTE" onDelete="cascade">
         <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_CLIENTINFO.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_CLIENTINFO.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -33,6 +33,9 @@
       <column name="CHECKORDERORG" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
       <column name="CHECKINOUTORG" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
       <column name="GROUPACCTINVLINES" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_CLIENT_CLIENTINFO">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADCLIENTINFO">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
@@ -54,8 +57,17 @@
       <foreign-key foreignTable="AD_TREE" name="ADTREESALESREG_ADCLIENTINFO">
         <reference local="AD_TREE_SALESREGION_ID" foreign="AD_TREE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_CLIENT_CLIENTINFO">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      <foreign-key foreignTable="C_UOM" name="C_UOM_LENGTH_AD_CLIENTINFO">
+        <reference local="C_UOM_LENGTH_ID" foreign="C_UOM_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_UOM" name="C_UOM_TIME_AD_CLIENTINFO">
+        <reference local="C_UOM_TIME_ID" foreign="C_UOM_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_UOM" name="C_UOM_VOLUME_AD_CLIENTINFO">
+        <reference local="C_UOM_VOLUME_ID" foreign="C_UOM_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_UOM" name="C_UOM_WEIGHT_AD_CLIENTINFO">
+        <reference local="C_UOM_WEIGHT_ID" foreign="C_UOM_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA1_ADCLIENTINFO">
         <reference local="C_ACCTSCHEMA1_ID" foreign="C_ACCTSCHEMA_ID"/>
@@ -72,18 +84,6 @@
       <foreign-key foreignTable="C_CALENDAR" name="CCALENDAR_ADCLIENTINFO">
         <reference local="C_CALENDAR_ID" foreign="C_CALENDAR_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_UOM" name="C_UOM_LENGTH_AD_CLIENTINFO">
-        <reference local="C_UOM_LENGTH_ID" foreign="C_UOM_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_UOM" name="C_UOM_TIME_AD_CLIENTINFO">
-        <reference local="C_UOM_TIME_ID" foreign="C_UOM_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_UOM" name="C_UOM_VOLUME_AD_CLIENTINFO">
-        <reference local="C_UOM_VOLUME_ID" foreign="C_UOM_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_UOM" name="C_UOM_WEIGHT_AD_CLIENTINFO">
-        <reference local="C_UOM_WEIGHT_ID" foreign="C_UOM_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_ADCLIENTINFO">
         <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_COLUMN.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_COLUMN.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -43,12 +43,6 @@
       <column name="ISDESENCRYPTABLE" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="AD_CALLOUT_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="DEVELOPMENTSTATUS" primaryKey="false" required="false" type="VARCHAR" size="2" default="RE" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_CALLOUT" name="ADCOLUMN_FK_CALLOUT">
-        <reference local="AD_CALLOUT_ID" foreign="AD_CALLOUT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_PROCESS" name="ADPROCESS_ADCOLUMN" onDelete="setnull">
-        <reference local="AD_PROCESS_ID" foreign="AD_PROCESS_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ELEMENT" name="AD_ELEMENT_AD_COLUMN">
         <reference local="AD_ELEMENT_ID" foreign="AD_ELEMENT_ID"/>
       </foreign-key>
@@ -64,6 +58,12 @@
       <foreign-key foreignTable="AD_VAL_RULE" name="AD_VALRULE_COLUMN">
         <reference local="AD_VAL_RULE_ID" foreign="AD_VAL_RULE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_CALLOUT" name="ADCOLUMN_FK_CALLOUT">
+        <reference local="AD_CALLOUT_ID" foreign="AD_CALLOUT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_PROCESS" name="ADPROCESS_ADCOLUMN" onDelete="setnull">
+        <reference local="AD_PROCESS_ID" foreign="AD_PROCESS_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="COLUMNCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_ELEMENT_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_ELEMENT_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -19,6 +19,9 @@
       <column name="PO_DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="PO_HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_AD_ELEMENT_TRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADELEMENTTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -28,9 +31,6 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADELEMENTTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_AD_ELEMENT_TRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
       <check name="ADELEMENTTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADELEMENTTRL_IS_ANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_FIELD.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_FIELD.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -28,15 +28,15 @@
       <column name="ISENCRYPTED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="ENTITYTYPE" primaryKey="false" required="false" type="CHAR" size="1" default="D" autoIncrement="false"/>
       <column name="SHOWINRELATION" primaryKey="false" required="false" type="VARCHAR" size="1" default="Y" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_FIELDGROUP" name="ADFIELDGROUP_ADFIELD">
-        <reference local="AD_FIELDGROUP_ID" foreign="AD_FIELDGROUP_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_COLUMN" name="AD_COLUMN_FIELD">
         <reference local="AD_COLUMN_ID" foreign="AD_COLUMN_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_TAB" name="AD_TAB_FIELD" onDelete="cascade">
         <reference local="AD_TAB_ID" foreign="AD_TAB_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_FIELDGROUP" name="ADFIELDGROUP_ADFIELD">
+        <reference local="AD_FIELDGROUP_ID" foreign="AD_FIELDGROUP_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="FIELDCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_FIELD_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_FIELD_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_FIELD" name="AD_FIELDTRL" onDelete="cascade">
+        <reference local="AD_FIELD_ID" foreign="AD_FIELD_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_FIELDTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADFIELDTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADFIELDTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_FIELD" name="AD_FIELDTRL" onDelete="cascade">
-        <reference local="AD_FIELD_ID" foreign="AD_FIELD_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_FIELDTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
       <check name="ADFIELDTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADFIELDTRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_MENU.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_MENU.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -23,6 +23,9 @@
       <column name="AD_WORKBENCH_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ENTITYTYPE" primaryKey="false" required="false" type="CHAR" size="1" default="D" autoIncrement="false"/>
       <column name="URL" primaryKey="false" required="false" type="VARCHAR" size="4000" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_MENU_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADMENU">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -44,9 +47,6 @@
       <foreign-key foreignTable="AD_WORKFLOW" name="ADWORKFLOW_ADMENU">
         <reference local="AD_WORKFLOW_ID" foreign="AD_WORKFLOW_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_MENU_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="ADMENU_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADMENU_ISREADONLY_CHECK"><![CDATA[ISREADONLY IN ('Y', 'N')]]></check>
       <check name="ADMENU_ISSOTRX_CHECK"><![CDATA[ISSOTRX IN ('Y', 'N')]]></check>
--- a/database/model/tables/AD_MENU_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_MENU_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,18 +13,18 @@
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_MENUTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_MENU" name="AD_MENUTRL" onDelete="cascade">
+        <reference local="AD_MENU_ID" foreign="AD_MENU_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADMENUTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADMENUTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_MENUTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_MENU" name="AD_MENUTRL" onDelete="cascade">
-        <reference local="AD_MENU_ID" foreign="AD_MENU_ID"/>
-      </foreign-key>
       <check name="ADMENUTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADMENUTRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_MESSAGE_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_MESSAGE_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,18 +13,18 @@
       <column name="MSGTEXT" primaryKey="false" required="true" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="MSGTIP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_MESSAGETRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_MESSAGE" name="AD_MESSAGETRL" onDelete="cascade">
+        <reference local="AD_MESSAGE_ID" foreign="AD_MESSAGE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADMESSAGETRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADMESSAGETRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_MESSAGETRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_MESSAGE" name="AD_MESSAGETRL" onDelete="cascade">
-        <reference local="AD_MESSAGE_ID" foreign="AD_MESSAGE_ID"/>
-      </foreign-key>
       <check name="ADMESSAGE_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADMESSAGE_TRL_ISTRANSD_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_MODEL_OBJECT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_MODEL_OBJECT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -20,6 +20,12 @@
       <column name="AD_FORM_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="AD_REFERENCE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="AD_CALLOUT_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="MODELOBJ_FK_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="MODELOBJ_FK_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CALLOUT" name="MODELOBJECT_FK_CALLOUT">
         <reference local="AD_CALLOUT_ID" foreign="AD_CALLOUT_ID"/>
       </foreign-key>
@@ -44,12 +50,6 @@
       <foreign-key foreignTable="AD_WORKFLOW" name="MODELOBJECT_FK_WORKFLOW">
         <reference local="AD_WORKFLOW_ID" foreign="AD_WORKFLOW_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="MODELOBJ_FK_CLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="MODELOBJ_FK_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <unique name="AD_MODEL_OBJECT_CLASSNAME">
         <unique-column name="CLASSNAME"/>
       </unique>
--- a/database/model/tables/AD_ORGINFO.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_ORGINFO.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,18 +15,18 @@
       <column name="C_BPARTNER_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="LOGO" primaryKey="false" required="false" type="NVARCHAR" size="200" autoIncrement="false"/>
       <column name="REFERENCE_ORDER" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_AD_ORGINFO">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADORGINFO">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_AD_ORGINFO">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="C_LOCATION" name="C_LOCATION_AD_ORGINFO">
+        <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_ADORGINFO">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_LOCATION" name="C_LOCATION_AD_ORGINFO">
-        <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="PA_GOAL" name="PAGOAL_AD_ORGINFO">
         <reference local="PA_GOAL_ID" foreign="PA_GOAL_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_PRINTFORMAT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_PRINTFORMAT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -24,6 +24,9 @@
       <column name="AD_REPORTVIEW_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="AD_PRINTTABLEFORMAT_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="PRINTERNAME" primaryKey="false" required="false" type="NVARCHAR" size="40" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_PRINTFONT" name="AD_PRINTFONT_ADPRINTFORMAT">
+        <reference local="AD_PRINTFONT_ID" foreign="AD_PRINTFONT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADPRINTFORMAT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -45,9 +48,6 @@
       <foreign-key foreignTable="AD_TABLE" name="ADTABLE_ADPRINTFORMAT">
         <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_PRINTFONT" name="AD_PRINTFONT_ADPRINTFORMAT">
-        <reference local="AD_PRINTFONT_ID" foreign="AD_PRINTFONT_ID"/>
-      </foreign-key>
       <index name="AD_PRINTFORMAT_TABLE" unique="false">
         <index-column name="AD_TABLE_ID"/>
       </index>
--- a/database/model/tables/AD_PRINTGRAPH.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_PRINTGRAPH.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -25,6 +25,9 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADPRINTGRAPH">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_PRINTFORMAT" name="ADPRINTFORMAT_ADPRINTGRAPH">
+        <reference local="AD_PRINTFORMAT_ID" foreign="AD_PRINTFORMAT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_PRINTFORMATITEM" name="ADPRINTFORMATITEM_GRAPHDATA">
         <reference local="DATA_PRINTFORMATITEM_ID" foreign="AD_PRINTFORMATITEM_ID"/>
       </foreign-key>
@@ -43,9 +46,6 @@
       <foreign-key foreignTable="AD_PRINTFORMATITEM" name="ADPRINTFORMATITEM_GRAPHDESCR">
         <reference local="DESCRIPTION_PRINTFORMATITEM_ID" foreign="AD_PRINTFORMATITEM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_PRINTFORMAT" name="ADPRINTFORMAT_ADPRINTGRAPH">
-        <reference local="AD_PRINTFORMAT_ID" foreign="AD_PRINTFORMAT_ID"/>
-      </foreign-key>
       <check name="AD_PRINTGRAPH_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/AD_PROCESS_ACCESS.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_PROCESS_ACCESS.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,18 +11,18 @@
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISREADWRITE" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_PROCESSACCESS_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_PROCESSTACCESS_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_PROCESS" name="ADPROCESS_ADPROCESSACCESS" onDelete="cascade">
         <reference local="AD_PROCESS_ID" foreign="AD_PROCESS_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ROLE" name="ADROLE_ADPROCESSACCESS" onDelete="cascade">
         <reference local="AD_ROLE_ID" foreign="AD_ROLE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_PROCESSACCESS_CLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_PROCESSTACCESS_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <index name="AD_PROCESS_ACCESS_UN_KEY" unique="true">
         <index-column name="AD_ROLE_ID"/>
         <index-column name="AD_PROCESS_ID"/>
--- a/database/model/tables/AD_PROCESS_PARA.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_PROCESS_PARA.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -41,12 +41,12 @@
       <foreign-key foreignTable="AD_PROCESS" name="ADPROCESS_ADPROCESSPARA" onDelete="cascade">
         <reference local="AD_PROCESS_ID" foreign="AD_PROCESS_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_REFERENCE" name="ADREFERENCE_ADPROCESSPARA">
+        <reference local="AD_REFERENCE_ID" foreign="AD_REFERENCE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_REFERENCE" name="ADREFERENCEVALUE_ADPROCPARA">
         <reference local="AD_REFERENCE_VALUE_ID" foreign="AD_REFERENCE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_REFERENCE" name="ADREFERENCE_ADPROCESSPARA">
-        <reference local="AD_REFERENCE_ID" foreign="AD_REFERENCE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_VAL_RULE" name="ADVALRULE_AD_PROCESSPARA">
         <reference local="AD_VAL_RULE_ID" foreign="AD_VAL_RULE_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_PROCESS_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_PROCESS_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_AD_PROCESS_TRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_PROCESS" name="AD_PROCESS_AD_PROCESS_TRL" onDelete="cascade">
+        <reference local="AD_PROCESS_ID" foreign="AD_PROCESS_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADPROCESSTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADPROCESSTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_AD_PROCESS_TRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_PROCESS" name="AD_PROCESS_AD_PROCESS_TRL" onDelete="cascade">
-        <reference local="AD_PROCESS_ID" foreign="AD_PROCESS_ID"/>
-      </foreign-key>
       <check name="ADPROCESSTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADPROCESSTRL_IS_ANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_REFERENCE_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_REFERENCE_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_REFERENCETRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_REFERENCE" name="AD_REFERENCETRL" onDelete="cascade">
+        <reference local="AD_REFERENCE_ID" foreign="AD_REFERENCE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADREFERENCETRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADREFERENCETRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_REFERENCETRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_REFERENCE" name="AD_REFERENCETRL" onDelete="cascade">
-        <reference local="AD_REFERENCE_ID" foreign="AD_REFERENCE_ID"/>
-      </foreign-key>
       <check name="ADREFTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADREFTRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_REF_LIST_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_REF_LIST_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,18 +13,18 @@
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_REFLISTTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_REF_LIST" name="AD_REFLISTTRL" onDelete="cascade">
+        <reference local="AD_REF_LIST_ID" foreign="AD_REF_LIST_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADREFLISTTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADREFLISTTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_REFLISTTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_REF_LIST" name="AD_REFLISTTRL" onDelete="cascade">
-        <reference local="AD_REF_LIST_ID" foreign="AD_REF_LIST_ID"/>
-      </foreign-key>
       <check name="ADREFLISTTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADREFLISTTRL_IS_ANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_REF_TABLE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_REF_TABLE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,9 +16,6 @@
       <column name="WHERECLAUSE" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ORDERBYCLAUSE" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ENTITYTYPE" primaryKey="false" required="false" type="CHAR" size="1" default="D" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_TABLE" name="ADD_TABLE_REFTABLE">
-        <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_COLUMN" name="AD_COLUMN_REFTABLE_DISPLAY">
         <reference local="AD_DISPLAY" foreign="AD_COLUMN_ID"/>
       </foreign-key>
@@ -28,6 +25,9 @@
       <foreign-key foreignTable="AD_REFERENCE" name="AD_REFERENCE_REFTABLE" onDelete="cascade">
         <reference local="AD_REFERENCE_ID" foreign="AD_REFERENCE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_TABLE" name="ADD_TABLE_REFTABLE">
+        <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="REF_TABLECLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_ROLE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_ROLE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -19,15 +19,15 @@
       <column name="AD_TREE_MENU_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISMANUAL" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="PROCESSING" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_TREE" name="ADTREE_ADROLE">
-        <reference local="AD_TREE_MENU_ID" foreign="AD_TREE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="AD_ROLECLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ROLEORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_TREE" name="ADTREE_ADROLE">
+        <reference local="AD_TREE_MENU_ID" foreign="AD_TREE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_CURRENCY" name="C_CURRENCY_AD_ROLE">
         <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_SEQUENCE_AUDIT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_SEQUENCE_AUDIT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,12 +12,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="AD_TABLE_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="RECORD_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_SEQUENCE" name="AD_SEQUENCE_SEQUENCEAUDIT" onDelete="cascade">
+        <reference local="AD_SEQUENCE_ID" foreign="AD_SEQUENCE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_TABLE" name="ADTABLE_ADSEQUENCEAUDIT" onDelete="cascade">
         <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_SEQUENCE" name="AD_SEQUENCE_SEQUENCEAUDIT" onDelete="cascade">
-        <reference local="AD_SEQUENCE_ID" foreign="AD_SEQUENCE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="SEQUENCE_AUDITCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_TAB.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_TAB.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -36,6 +36,15 @@
       <column name="INCLUDED_TAB_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="FILTERCLAUSE" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="EDITREFERENCE" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_COLUMN" name="AD_COLUMN_AD_TAB">
+        <reference local="AD_COLUMN_ID" foreign="AD_COLUMN_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_TABLE" name="AD_TABLE_TAB">
+        <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_WINDOW" name="AD_WINDOW_TAB" onDelete="cascade">
+        <reference local="AD_WINDOW_ID" foreign="AD_WINDOW_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_COLUMN" name="ADCOLUMN_ADTABSORTORDER">
         <reference local="AD_COLUMNSORTORDER_ID" foreign="AD_COLUMN_ID"/>
       </foreign-key>
@@ -54,15 +63,6 @@
       <foreign-key foreignTable="AD_TAB" name="ADTAB_INCLUDED">
         <reference local="INCLUDED_TAB_ID" foreign="AD_TAB_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_COLUMN" name="AD_COLUMN_AD_TAB">
-        <reference local="AD_COLUMN_ID" foreign="AD_COLUMN_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_TABLE" name="AD_TABLE_TAB">
-        <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_WINDOW" name="AD_WINDOW_TAB" onDelete="cascade">
-        <reference local="AD_WINDOW_ID" foreign="AD_WINDOW_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="TABCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/database/model/tables/AD_TABLE_ACCESS.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_TABLE_ACCESS.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,17 +12,17 @@
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="ISREADONLY" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="ISEXCLUDE" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_DATAACCESSCLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_DATAACCESSORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ROLE" name="ADROLE_ADTABLEACCESS" onDelete="cascade">
         <reference local="AD_ROLE_ID" foreign="AD_ROLE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_TABLE" name="ADTABLE_ADTABLEACCESS" onDelete="cascade">
         <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_DATAACCESSCLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_DATAACCESSORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
     </table>
   </database>
--- a/database/model/tables/AD_TAB_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_TAB_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,18 +15,18 @@
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="COMMITWARNING" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_TABTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_TAB" name="AD_TABTRL" onDelete="cascade">
+        <reference local="AD_TAB_ID" foreign="AD_TAB_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADTABTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADTABTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_TABTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_TAB" name="AD_TABTRL" onDelete="cascade">
-        <reference local="AD_TAB_ID" foreign="AD_TAB_ID"/>
-      </foreign-key>
       <check name="ADTABTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADTABTRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_TASK_ACCESS.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_TASK_ACCESS.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,18 +11,18 @@
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISREADWRITE" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_TASKACCESS_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_TASKACCESS_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ROLE" name="ADROLE_ADTASKACCESS" onDelete="cascade">
         <reference local="AD_ROLE_ID" foreign="AD_ROLE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_TASK" name="ADTASK_ADTASKACCESS" onDelete="cascade">
         <reference local="AD_TASK_ID" foreign="AD_TASK_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_TASKACCESS_CLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_TASKACCESS_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <index name="AD_TASK_ACCESS_UN_KEY" unique="true">
         <index-column name="AD_ROLE_ID"/>
         <index-column name="AD_TASK_ID"/>
--- a/database/model/tables/AD_TASK_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_TASK_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_TASKTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_TASK" name="AD_TASKTRL" onDelete="cascade">
+        <reference local="AD_TASK_ID" foreign="AD_TASK_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADTASKTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADTASKTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_TASKTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_TASK" name="AD_TASKTRL" onDelete="cascade">
-        <reference local="AD_TASK_ID" foreign="AD_TASK_ID"/>
-      </foreign-key>
       <check name="ADTASKTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADTASKTRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_TEXTINTERFACES_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_TEXTINTERFACES_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,18 +12,18 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="TEXT" primaryKey="false" required="true" type="VARCHAR" size="4000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_TEXTINTERFACESTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_TEXTINTERFACES" name="AD_TEXTINTERFACESTRL">
+        <reference local="AD_TEXTINTERFACES_ID" foreign="AD_TEXTINTERFACES_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADTEXTINTERFACESTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADTEXTINTERFACESTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_TEXTINTERFACESTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_TEXTINTERFACES" name="AD_TEXTINTERFACESTRL">
-        <reference local="AD_TEXTINTERFACES_ID" foreign="AD_TEXTINTERFACES_ID"/>
-      </foreign-key>
       <index name="AD_TEXTINTERFACES_TRL_UN_KEY" unique="true">
         <index-column name="AD_LANGUAGE"/>
         <index-column name="AD_TEXTINTERFACES_ID"/>
--- a/database/model/tables/AD_USER.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_USER.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -39,30 +39,30 @@
       <column name="DEFAULT_AD_ORG_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="DEFAULT_AD_ROLE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="DEFAULT_M_WAREHOUSE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_USER_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_USER_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADUSERDEFAULT">
         <reference local="DEFAULT_AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_LANGUAGE" name="ADLANGUAGE_ADUSERDEFAULT">
         <reference local="DEFAULT_AD_LANGUAGE" foreign="AD_LANGUAGE"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_ADUSERDEFAULT">
+        <reference local="DEFAULT_AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTRX_ADUSER">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_ADUSERDEFAULT">
-        <reference local="DEFAULT_AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ROLE" name="ADROLE_ADUSERDEFAULT">
         <reference local="DEFAULT_AD_ROLE_ID" foreign="AD_ROLE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_USER" name="ADUSER_SUPERVISOR">
         <reference local="SUPERVISOR_ID" foreign="AD_USER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_USER_CLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_USER_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_ADUSER">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
@@ -75,12 +75,12 @@
       <foreign-key foreignTable="M_WAREHOUSE" name="MWAREHOUSE_ADUSERDEFAULT">
         <reference local="DEFAULT_M_WAREHOUSE_ID" foreign="M_WAREHOUSE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="PA_GOAL" name="PAGOAL_ADUSER">
+        <reference local="PA_GOAL_ID" foreign="PA_GOAL_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="PA_GOAL" name="PAGOALPRIVATE_ADUSER">
         <reference local="PA_GOALPRIVATE_ID" foreign="PA_GOAL_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="PA_GOAL" name="PAGOAL_ADUSER">
-        <reference local="PA_GOAL_ID" foreign="PA_GOAL_ID"/>
-      </foreign-key>
       <index name="AD_USER_EMAIL" unique="false">
         <index-column name="EMAIL"/>
       </index>
--- a/database/model/tables/AD_USERDEF_WIN.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_USERDEF_WIN.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -34,7 +34,7 @@
         <reference local="AD_WINDOW_ID" foreign="AD_WINDOW_ID"/>
       </foreign-key>
       <check name="ADUSERDEFWIN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="ADUSERDEFWIN_IS_DATEABLE_CHECK"><![CDATA[ISUSERUPDATEABLE IN ('Y', 'N')]]></check>
       <check name="ADUSERDEFWIN_ISREADONLY_CHECK"><![CDATA[ISREADONLY IN ('Y', 'N')]]></check>
-      <check name="ADUSERDEFWIN_IS_DATEABLE_CHECK"><![CDATA[ISUSERUPDATEABLE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/AD_USER_ROLES.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_USER_ROLES.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -10,18 +10,18 @@
       <column name="CREATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_USERROLESCLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_USERROLESORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ROLE" name="ADROLE_ADUSERROLES" onDelete="cascade">
         <reference local="AD_ROLE_ID" foreign="AD_ROLE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_USER" name="ADUSER_USERROLES" onDelete="cascade">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_USERROLESCLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_USERROLESORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="AD_USER_ROLES_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/AD_WF_NODE_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_WF_NODE_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_WFNODETRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_WF_NODE" name="AD_WFNODETRL" onDelete="cascade">
+        <reference local="AD_WF_NODE_ID" foreign="AD_WF_NODE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADWFNODETRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADWFNODETRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_WFNODETRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_WF_NODE" name="AD_WFNODETRL" onDelete="cascade">
-        <reference local="AD_WF_NODE_ID" foreign="AD_WF_NODE_ID"/>
-      </foreign-key>
       <index name="AD_WF_NODE_TRL_UN_KEY" unique="true">
         <index-column name="AD_WF_NODE_ID"/>
         <index-column name="AD_LANGUAGE"/>
--- a/database/model/tables/AD_WINDOW_ACCESS.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_WINDOW_ACCESS.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,18 +11,18 @@
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISREADWRITE" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_FUNCTACCESS_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_FUNCTACCESSORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ROLE" name="ADROLE_ADWINDOWACCESS" onDelete="cascade">
         <reference local="AD_ROLE_ID" foreign="AD_ROLE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_WINDOW" name="ADWINDOW_ADWINDOWACCESS" onDelete="cascade">
         <reference local="AD_WINDOW_ID" foreign="AD_WINDOW_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_FUNCTACCESSORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_FUNCTACCESS_CLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
       <index name="AD_WINDOW_ACCESS_UN_KEY" unique="true">
         <index-column name="AD_ROLE_ID"/>
         <index-column name="AD_WINDOW_ID"/>
--- a/database/model/tables/AD_WINDOW_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_WINDOW_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_WINDOWTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_WINDOW" name="AD_WINDOWTRL" onDelete="cascade">
+        <reference local="AD_WINDOW_ID" foreign="AD_WINDOW_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADWINDOWTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADWINDOWTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_WINDOWTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_WINDOW" name="AD_WINDOWTRL" onDelete="cascade">
-        <reference local="AD_WINDOW_ID" foreign="AD_WINDOW_ID"/>
-      </foreign-key>
       <check name="ADWINDOWTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADWINDOWTRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AD_WORKFLOW_ACCESS.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_WORKFLOW_ACCESS.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,18 +11,18 @@
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISREADWRITE" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_WORKFLOWACCESS_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_WORKFLOWACCESS_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ROLE" name="ADROLE_ADWORKFLOWACCESS" onDelete="cascade">
         <reference local="AD_ROLE_ID" foreign="AD_ROLE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_WORKFLOW" name="ADWORKFOW_WORKFLOWACCESS" onDelete="cascade">
         <reference local="AD_WORKFLOW_ID" foreign="AD_WORKFLOW_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="AD_WORKFLOWACCESS_CLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_WORKFLOWACCESS_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <index name="AD_WORKFLOW_ACCESS_UN_KEY" unique="true">
         <index-column name="AD_ROLE_ID"/>
         <index-column name="AD_WORKFLOW_ID"/>
--- a/database/model/tables/AD_WORKFLOW_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AD_WORKFLOW_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="HELP" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false"/>
       <column name="ISTRANSLATED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_WORKFLOWTRL">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_WORKFLOW" name="AD_WORKFLOWTRL" onDelete="cascade">
+        <reference local="AD_WORKFLOW_ID" foreign="AD_WORKFLOW_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ADWORKFLOWTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ADWORKFLOWTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_WORKFLOWTRL">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_WORKFLOW" name="AD_WORKFLOWTRL" onDelete="cascade">
-        <reference local="AD_WORKFLOW_ID" foreign="AD_WORKFLOW_ID"/>
-      </foreign-key>
       <check name="ADWORKFLOWTRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ADWORKFLOWTRL_ISTRANS_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/AT_COMMAND.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AT_COMMAND.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -22,15 +22,15 @@
       <column name="REMEMBER_TAB" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="CHECK_WRITEABLE" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="ASSERTION" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATCOMMAND">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ATCOMMAND">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATCOMMAND">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
-      <check name="ATCOMMANDLINEINTERCH_CHECK"><![CDATA[LINE_INTERCHANGE IN ('Y', 'N')]]></check>
       <check name="ATCOMMAND_HASPREFIX_CHECK"><![CDATA[HAS_PREFIX IN ('Y', 'N')]]></check>
       <check name="ATCOMMAND_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="ATCOMMANDLINEINTERCH_CHECK"><![CDATA[LINE_INTERCHANGE IN ('Y', 'N')]]></check>
       <check name="ATCOMMAND_REMFRAME_CHECK"><![CDATA[REMEMBER_FRAME IN ('Y', 'N')]]></check>
       <check name="ATCOMMAND_REMTAB_CHECK"><![CDATA[REMEMBER_TAB IN ('Y', 'N')]]></check>
       <check name="ATCOMMAND_REMWINDOW_CHECK"><![CDATA[REMEMBER_WINDOW IN ('Y', 'N')]]></check>
--- a/database/model/tables/AT_COMMAND_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AT_COMMAND_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,15 +16,15 @@
       <column name="ARGHELP1" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="ARGHELP2" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="ARGHELP3" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_ATCOMMAND">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ATCOMMANDTRL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_ATCOMMANDTRL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_ATCOMMAND">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
       <foreign-key foreignTable="AT_COMMAND" name="AT_COMMANDTRL">
         <reference local="AT_COMMAND_ID" foreign="AT_COMMAND_ID"/>
       </foreign-key>
--- a/database/model/tables/AT_LINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AT_LINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -21,12 +21,12 @@
       <column name="ARGHELP1" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="ARGHELP2" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="ARGHELP3" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATLINE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ATLINE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATLINE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AT_COMMAND" name="AT_COMMAND_ATLINE">
         <reference local="AT_COMMAND_ID" foreign="AT_COMMAND_ID"/>
       </foreign-key>
--- a/database/model/tables/AT_TEST.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AT_TEST.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -20,12 +20,12 @@
       <column name="AT_ROLLOGIN_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISSUMMARY" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="ACTION" primaryKey="false" required="false" type="CHAR" size="1" default="T" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATTEST">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ATTEST">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATTEST">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AT_ROLLOGIN" name="ATROLLOGIN_ATTEST">
         <reference local="AT_ROLLOGIN_ID" foreign="AT_ROLLOGIN_ID"/>
       </foreign-key>
--- a/database/model/tables/AT_TESTDOCUMENT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AT_TESTDOCUMENT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -23,15 +23,15 @@
       <column name="LINE_INTERCHANGER" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="PREFIX" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="INTRODUCTION" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ATTESTDOCUMENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_AT_TESTDOCUMENT">
         <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATTESTDOCUMENT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ATTESTDOCUMENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
       <check name="ATTESTDOCUMENT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="ATTESTDOCUMENT_LINEINTER_CHECK"><![CDATA[LINE_INTERCHANGER IN ('Y', 'N')]]></check>
       <check name="ATTESTDOCUMENT_ODUCTION_CHECK"><![CDATA[INTRODUCTION IN ('Y', 'N')]]></check>
--- a/database/model/tables/AT_TESTDOCUMENTLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/AT_TESTDOCUMENTLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -22,18 +22,18 @@
       <column name="ARGTYPE2" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="ARGTYPE1" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="ASSERTPREFIX" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATTESTDOCUMENTLINE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_ATTESTDOCUMENTLINE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_ATTESTDOCUMENTLINE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="AT_COMMAND" name="AT_COMMAND_ATTESTDOCUMENTLINE">
+        <reference local="AT_COMMAND_ID" foreign="AT_COMMAND_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AT_TESTDOCUMENT" name="ATTESTDOCUMENT_TESTDOCLINE">
         <reference local="AT_TESTDOCUMENT_ID" foreign="AT_TESTDOCUMENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AT_COMMAND" name="AT_COMMAND_ATTESTDOCUMENTLINE">
-        <reference local="AT_COMMAND_ID" foreign="AT_COMMAND_ID"/>
-      </foreign-key>
       <unique name="AT_TESTDOCUMENTLINE_UNIQUE">
         <unique-column name="AT_TESTDOCUMENT_ID"/>
         <unique-column name="AT_COMMAND_ID"/>
--- a/database/model/tables/A_AMORTIZATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/A_AMORTIZATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -25,15 +25,6 @@
       <column name="C_CURRENCY_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="POSTING" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="TOTALAMORTIZATION" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_AAMORTIZATION">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="A_AMORTIZATION_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_CURRENCY" name="A_AMORTIZATIO_CURRENCY">
-        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ACTIVITY" name="A_AMORTIZA_ACTIVITY">
         <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
       </foreign-key>
@@ -43,6 +34,15 @@
       <foreign-key foreignTable="C_PROJECT" name="A_AMORTIZA_PROJECT">
         <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_CURRENCY" name="A_AMORTIZATIO_CURRENCY">
+        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="A_AMORTIZATION_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_AAMORTIZATION">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
       <check name="A_AMORTIZATION_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/A_AMORTIZATIONLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/A_AMORTIZATIONLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,12 +15,6 @@
       <column name="AMORTIZATION_PORCENTAGE" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="AMORTIZATIONAMT" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="C_CURRENCY_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
-      <foreign-key foreignTable="A_ASSET" name="AASSET_AAMORTIZATIONLINE">
-        <reference local="A_ASSET_ID" foreign="A_ASSET_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_AAMORTIZATIONLINE">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="A_AMORTIZATION" name="A_AMORTIZALINE_AMORTIZA">
         <reference local="A_AMORTIZATION_ID" foreign="A_AMORTIZATION_ID"/>
       </foreign-key>
@@ -30,6 +24,12 @@
       <foreign-key foreignTable="AD_ORG" name="A_AMORTIZATIONLINE_ORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="A_ASSET" name="AASSET_AAMORTIZATIONLINE">
+        <reference local="A_ASSET_ID" foreign="A_ASSET_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_AAMORTIZATIONLINE">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
       <check name="A_AMORTIZATIONL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/A_ASSET.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/A_ASSET.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -60,6 +60,12 @@
       <column name="DEPRECIATEDPLAN" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="DEPRECIATEDPREVIOUSAMT" primaryKey="false" required="false" type="DECIMAL" default="0" autoIncrement="false"/>
       <column name="DEPRECIATEDVALUE" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
+      <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="A_ASSET_ATTRIBUTESETINSTANCE">
+        <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_CURRENCY" name="A_ASSET_CURRENCY">
+        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="A_ASSET_GROUP" name="AASSETGROUP_AASSET">
         <reference local="A_ASSET_GROUP_ID" foreign="A_ASSET_GROUP_ID"/>
       </foreign-key>
@@ -72,12 +78,6 @@
       <foreign-key foreignTable="AD_USER" name="ADUSER_AASSET">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="A_ASSET_ATTRIBUTESETINSTANCE">
-        <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_CURRENCY" name="A_ASSET_CURRENCY">
-        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_AASSET">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
--- a/database/model/tables/C_ACCTSCHEMA.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_ACCTSCHEMA.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -30,12 +30,12 @@
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_C_ACCTSCHEMA">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_CURRENCY" name="C_CURRENCY_C_ACCTSCHEMA">
+        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_PERIOD" name="CPERIOD_CACCTSCHEMA">
         <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_CURRENCY" name="C_CURRENCY_C_ACCTSCHEMA">
-        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
-      </foreign-key>
       <unique name="C_ACCTSCHEMA_NAME">
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
--- a/database/model/tables/C_ACCTSCHEMA_DEFAULT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_ACCTSCHEMA_DEFAULT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -163,12 +163,12 @@
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_EPREPAYMENT_CSCHEMADEFAULT">
         <reference local="E_PREPAYMENT_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDREC_CSCHEMADEFAU">
+        <reference local="NOTINVOICEDRECEIVABLES_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDRECEIPTS_CSCHEMA">
         <reference local="NOTINVOICEDRECEIPTS_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDREC_CSCHEMADEFAU">
-        <reference local="NOTINVOICEDRECEIVABLES_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDREVENUE_CSCHEMAD">
         <reference local="NOTINVOICEDREVENUE_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
@@ -238,12 +238,12 @@
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_UNREALIZEDLOSS_CSCHEMADEFAU">
         <reference local="UNREALIZEDLOSS_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITY_CSCHEMADEFAULT">
+        <reference local="V_LIABILITY_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITYSERVICES_CSCHEMAD">
         <reference local="V_LIABILITY_SERVICES_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITY_CSCHEMADEFAULT">
-        <reference local="V_LIABILITY_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VPREPAYMENT_CSCHEMADEFAULT">
         <reference local="V_PREPAYMENT_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
--- a/database/model/tables/C_ACCTSCHEMA_ELEMENT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_ACCTSCHEMA_ELEMENT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -28,12 +28,12 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CASCHEMAELEMENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_CASCHEMAELEMENT">
+        <reference local="ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGID_C_ASCHEMAELEMENT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_CASCHEMAELEMENT">
-        <reference local="ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_CASCHEMAELEMENT" onDelete="cascade">
         <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
       </foreign-key>
@@ -43,12 +43,12 @@
       <foreign-key foreignTable="C_BPARTNER" name="CBUSPARTNER_CASCHEMAELEMENT">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ELEMENT" name="CELEMENT_CASCHEMAELEMENT">
+        <reference local="C_ELEMENT_ID" foreign="C_ELEMENT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUE_CASCHEMAELEMENT">
         <reference local="C_ELEMENTVALUE_ID" foreign="C_ELEMENTVALUE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ELEMENT" name="CELEMENT_CASCHEMAELEMENT">
-        <reference local="C_ELEMENT_ID" foreign="C_ELEMENT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_LOCATION" name="CLOCATION_CASCHEMAELEMENT">
         <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
       </foreign-key>
--- a/database/model/tables/C_APPROVAL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_APPROVAL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,15 +15,15 @@
       <column name="ISWORKFLOWAPPROVED" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
       <column name="AD_WORKFLOW_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISPRODUCTATTRIBUTEAPPROVED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_WORKFLOW" name="AD_WORKFLOW_APPROVAL">
+        <reference local="AD_WORKFLOW_ID" foreign="AD_WORKFLOW_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CAPPROVAL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_CAPPROVAL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_WORKFLOW" name="AD_WORKFLOW_APPROVAL">
-        <reference local="AD_WORKFLOW_ID" foreign="AD_WORKFLOW_ID"/>
-      </foreign-key>
       <unique name="C_APPROVAL_NAME">
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
--- a/database/model/tables/C_BPARTNER.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_BPARTNER.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -84,21 +84,27 @@
       <column name="PO_FIXMONTHDAY3" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="SO_BANKACCOUNT_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="SO_BP_TAXCATEGORY_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_C_BUSPARTNER">
+        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CBPARTNER">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_CBPARTNER">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_C_BUSPARTNER">
-        <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BP_TAXCATEGORY" name="BP_CBPTAXCATEGORYPO">
         <reference local="PO_BP_TAXCATEGORY_ID" foreign="C_BP_TAXCATEGORY_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BP_TAXCATEGORY" name="BP_CBPTAXCATEGORYSO">
         <reference local="SO_BP_TAXCATEGORY_ID" foreign="C_BP_TAXCATEGORY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_WH_SCHEDULE" name="C_BPARTNER_SCHEDULE">
+        <reference local="M_WH_SCHEDULE_ID" foreign="M_WH_SCHEDULE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_SALARY_CATEGORY" name="C_SALARY_CATEGORY_CBPARTNER">
+        <reference local="C_SALARY_CATEGORY_ID" foreign="C_SALARY_CATEGORY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_CPBARTNERPARENT">
         <reference local="BPARTNER_PARENT_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
@@ -120,27 +126,21 @@
       <foreign-key foreignTable="C_PAYMENTTERM" name="CPOPAYMENTTERM_CBPARTNER">
         <reference local="PO_PAYMENTTERM_ID" foreign="C_PAYMENTTERM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_WH_SCHEDULE" name="C_BPARTNER_SCHEDULE">
-        <reference local="M_WH_SCHEDULE_ID" foreign="M_WH_SCHEDULE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_SALARY_CATEGORY" name="C_SALARY_CATEGORY_CBPARTNER">
-        <reference local="C_SALARY_CATEGORY_ID" foreign="C_SALARY_CATEGORY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="FORCEDORG_CBPARTNER">
         <reference local="AD_FORCED_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_DISCOUNTSCHEMA" name="MDISCOUNTS_CBPARTNER">
+        <reference local="M_DISCOUNTSCHEMA_ID" foreign="M_DISCOUNTSCHEMA_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_DISCOUNTSCHEMA" name="MDISCOUNTSPO_CBPARTNER">
         <reference local="PO_DISCOUNTSCHEMA_ID" foreign="M_DISCOUNTSCHEMA_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_DISCOUNTSCHEMA" name="MDISCOUNTS_CBPARTNER">
-        <reference local="M_DISCOUNTSCHEMA_ID" foreign="M_DISCOUNTSCHEMA_ID"/>
+      <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_CBPARTNER" onDelete="setnull">
+        <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRICELIST" name="MPRICELISTPO_CBUSPARTNER" onDelete="setnull">
         <reference local="PO_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_CBPARTNER" onDelete="setnull">
-        <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BANKACCOUNT" name="POBACKACCOUTN_CBPARTNER">
         <reference local="PO_BANKACCOUNT_ID" foreign="C_BANKACCOUNT_ID"/>
       </foreign-key>
--- a/database/model/tables/C_BPARTNER_LOCATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_BPARTNER_LOCATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -23,6 +23,12 @@
       <column name="C_LOCATION_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISTAXLOCATION" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="UPC" primaryKey="false" required="false" type="NVARCHAR" size="30" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="C_BUSPARTNER_LOCATIONCLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="C_BUSPARTNER_LOCATIONORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_CBPLOCATION" onDelete="cascade">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
@@ -32,12 +38,6 @@
       <foreign-key foreignTable="C_SALESREGION" name="CSALESREGION_BPARTNERLOCATION" onDelete="setnull">
         <reference local="C_SALESREGION_ID" foreign="C_SALESREGION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="C_BUSPARTNER_LOCATIONCLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="C_BUSPARTNER_LOCATIONORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <index name="C_BPLOCATION_BPARTNER" unique="false">
         <index-column name="C_BPARTNER_ID"/>
       </index>
--- a/database/model/tables/C_BP_GROUP_ACCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_BP_GROUP_ACCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -47,12 +47,12 @@
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_CRECEIVABLE_CBPGROUP">
         <reference local="C_RECEIVABLE_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDREC_CBPGROUP">
+        <reference local="NOTINVOICEDRECEIVABLES_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDRECEIPTS_CBPGROU">
         <reference local="NOTINVOICEDRECEIPTS_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDREC_CBPGROUP">
-        <reference local="NOTINVOICEDRECEIVABLES_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_NOTINVOICEDREVENUE_CBPGROUP">
         <reference local="NOTINVOICEDREVENUE_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
@@ -77,12 +77,12 @@
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_UNREALIZEDLOSS_CBPGROUP">
         <reference local="UNREALIZEDLOSS_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITY_CBPGROUP">
+        <reference local="V_LIABILITY_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITYSERVICES_CBPGROUP">
         <reference local="V_LIABILITY_SERVICES_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITY_CBPGROUP">
-        <reference local="V_LIABILITY_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VPREPAYMENT_CBPGROUP">
         <reference local="V_PREPAYMENT_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
--- a/database/model/tables/C_BP_VENDOR_ACCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_BP_VENDOR_ACCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -21,18 +21,18 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CBPVENDORACCT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BPARTNER" name="C_BUSPARTNER_C_BP_VENDOR_ACCT" onDelete="cascade">
+        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_CBPVENDORACCT" onDelete="cascade">
         <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BPARTNER" name="C_BUSPARTNER_C_BP_VENDOR_ACCT" onDelete="cascade">
-        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
+      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITY_CBPVENDOR">
+        <reference local="V_LIABILITY_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITYSERVICES_CBPVENDO">
         <reference local="V_LIABILITY_SERVICES_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VLIABILITY_CBPVENDOR">
-        <reference local="V_LIABILITY_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_VPREPAYMENT_CBPVENDOR">
         <reference local="V_PREPAYMENT_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
--- a/database/model/tables/C_BUDGETLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_BUDGETLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -33,26 +33,11 @@
       <foreign-key foreignTable="AD_CLIENT" name="AC_CLIENT_C_BUDGETLINE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORGTRX_C_BUDGETLINE">
-        <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_C_BUDGETLINE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_BUDGETLINE">
-        <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_BUDGET" name="CBUDGET_CBUDGETLINE">
-        <reference local="C_BUDGET_ID" foreign="C_BUDGET_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER1_BUDGETLINE">
-        <reference local="USER1_ID" foreign="C_ELEMENTVALUE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER2_BUDGETLINE">
-        <reference local="USER2_ID" foreign="C_ELEMENTVALUE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_PERIOD" name="CPERIOD_BUDGETLINE">
-        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORGTRX_C_BUDGETLINE">
+        <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BP_GROUP" name="C_BP_GROUP_C_BUDGETLINE">
         <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
@@ -75,12 +60,27 @@
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="C_VALIDCOMBINATION_CBUDGETLINE">
         <reference local="C_VALIDCOMBINATION_ID" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="M_PRODUCT_CATEGORY_CBUDGETLINE">
-        <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
+      <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_BUDGETLINE">
+        <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_BUDGET" name="CBUDGET_CBUDGETLINE">
+        <reference local="C_BUDGET_ID" foreign="C_BUDGET_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER1_BUDGETLINE">
+        <reference local="USER1_ID" foreign="C_ELEMENTVALUE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER2_BUDGETLINE">
+        <reference local="USER2_ID" foreign="C_ELEMENTVALUE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_PERIOD" name="CPERIOD_BUDGETLINE">
+        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_C_BUDGETLINE">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="M_PRODUCT_CATEGORY_CBUDGETLINE">
+        <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_CAMPAIGN" name="SO_CAMPAIGN_C_BUDGETLINE">
         <reference local="C_CAMPAIGN_ID" foreign="C_CAMPAIGN_ID"/>
       </foreign-key>
--- a/database/model/tables/C_CITY.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_CITY.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,18 +16,18 @@
       <column name="AREACODE" primaryKey="false" required="false" type="VARCHAR" size="10" autoIncrement="false"/>
       <column name="C_COUNTRY_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="C_REGION_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="C_CITYCLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="C_CITYORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_CCITY">
         <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_REGION" name="CREGION_CCITY">
         <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="C_CITYCLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="C_CITYORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="C_CITY_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_COMMISSION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_COMMISSION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -36,7 +36,7 @@
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
       <check name="CCOMMISSION_CREATEFROM_CHECK"><![CDATA[CREATEFROM IN ('Y', 'N')]]></check>
+      <check name="C_COMMISSION_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CCOMMISSION_LISTDETAILS_CHECK"><![CDATA[LISTDETAILS IN ('Y', 'N')]]></check>
-      <check name="C_COMMISSION_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_COMMISSIONLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_COMMISSIONLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -42,17 +42,17 @@
       <foreign-key foreignTable="C_SALESREGION" name="CSALESREGION_CCOMMISSIONLINE">
         <reference local="C_SALESREGION_ID" foreign="C_SALESREGION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CCOMMISSIONLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="MPRODUCTCAT_CCOMMISSIONLINE">
         <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CCOMMISSIONLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <index name="C_COMMISSIONLINE_COMMISSION" unique="false">
         <index-column name="C_COMMISSION_ID"/>
       </index>
       <check name="CCOMMISL_ISPOSITIVEONLY_CHECK"><![CDATA[ISPOSITIVEONLY IN ('Y', 'N')]]></check>
+      <check name="C_COMMISSIONLIN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CCOMNISL_COMMISRDERS_CHECK"><![CDATA[COMMISSIONORDERS IN ('Y', 'N')]]></check>
-      <check name="C_COMMISSIONLIN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_COMMISSIONRUN.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_COMMISSIONRUN.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -23,12 +23,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CCOMMISSIONRUN">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_INVOICE" name="C_INVOICE_CCOMMISSIONRUN">
+        <reference local="C_INVOICE_ID" foreign="C_INVOICE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_COMMISSION" name="CCOMMISSION_CCOMMISSIONRUN">
         <reference local="C_COMMISSION_ID" foreign="C_COMMISSION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_INVOICE" name="C_INVOICE_CCOMMISSIONRUN">
-        <reference local="C_INVOICE_ID" foreign="C_INVOICE_ID"/>
-      </foreign-key>
       <check name="C_COMMISRUN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="C_COMMISRUN_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/C_CONVERSION_RATE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_CONVERSION_RATE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,9 +16,6 @@
       <column name="CONVERSIONRATETYPE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
       <column name="MULTIPLYRATE" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
       <column name="DIVIDERATE" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
-      <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_CCONVERSIONRATE">
-        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="C_CONVERSION_RATECLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -28,6 +25,9 @@
       <foreign-key foreignTable="C_CURRENCY" name="C_CURRENCYCONVRATETO">
         <reference local="C_CURRENCY_ID_TO" foreign="C_CURRENCY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_CCONVERSIONRATE">
+        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
+      </foreign-key>
       <unique name="C_CONVERSIONRATE_ONCE">
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="AD_ORG_ID"/>
--- a/database/model/tables/C_COUNTRY.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_COUNTRY.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -25,18 +25,18 @@
       <foreign-key foreignTable="AD_LANGUAGE" name="ADLANGUAGE_CCOUNTRY">
         <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_CLIENT" name="C_COUNTRYCLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="C_COUNTRYORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_CCOUNTRY">
         <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_CCOUNTRY">
         <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="C_COUNTRYCLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="C_COUNTRYORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <unique name="C_COUNTRYCODE">
         <unique-column name="COUNTRYCODE"/>
       </unique>
--- a/database/model/tables/C_COUNTRY_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_COUNTRY_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -27,7 +27,7 @@
       <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_CCOUNTRYTRL">
         <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
       </foreign-key>
+      <check name="C_COUNTRY_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CCOUNTRYTRL_ISTRANSL_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
-      <check name="C_COUNTRY_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_CURRENCY_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_CURRENCY_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -25,7 +25,7 @@
       <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_CCURRENCYTRL">
         <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
       </foreign-key>
+      <check name="C_CURRENCY_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CCURR_TRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
-      <check name="C_CURRENCY_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_DEBT_PAYMENT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_DEBT_PAYMENT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -92,19 +92,19 @@
       <index name="SETTINVOICE_DEBT_PAYMENT" unique="false">
         <index-column name="C_INVOICE_ID"/>
       </index>
+      <check name="CANCEL_DEBT_PAYMENT"><![CDATA[(CANCEL_PROCESSED = 'N') OR (C_SETTLEMENT_CANCEL_ID IS NOT NULL)]]></check>
       <check name="CANCELISVALID_DEBT_PAYMENT"><![CDATA[(C_SETTLEMENT_CANCEL_ID IS NULL) OR (ISVALID = 'Y')]]></check>
-      <check name="CANCEL_DEBT_PAYMENT"><![CDATA[(CANCEL_PROCESSED = 'N') OR (C_SETTLEMENT_CANCEL_ID IS NOT NULL)]]></check>
       <check name="CBPARTNER_DEBT_PAYMENT"><![CDATA[C_BPARTNER_ID IS NOT NULL]]></check>
       <check name="CDEBTPAYM_CANCEL_PROCESSED"><![CDATA[CANCEL_PROCESSED IN ('Y', 'N')]]></check>
-      <check name="CDEBTPAYM_GENERATE_PROCESSED"><![CDATA[GENERATE_PROCESSED IN ('Y', 'N')]]></check>
-      <check name="CLINE_BSLINE_DEBT_PAYMENT"><![CDATA[(C_CASHLINE_ID IS NULL) OR (C_BANKSTATEMENTLINE_ID IS NULL)]]></check>
       <check name="C_DEBT_PAYMENT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="C_DEBT_PAYMENT_ISMANUAL"><![CDATA[ISMANUAL IN ('Y', 'N')]]></check>
       <check name="C_DEBT_PAYMENT_ISRECEIPT"><![CDATA[ISRECEIPT IN ('Y', 'N')]]></check>
       <check name="C_DEBT_PAYMENT_ISVALID"><![CDATA[ISVALID IN ('Y', 'N')]]></check>
+      <check name="CDEBTPAYM_GENERATE_PROCESSED"><![CDATA[GENERATE_PROCESSED IN ('Y', 'N')]]></check>
+      <check name="CLINE_BSLINE_DEBT_PAYMENT"><![CDATA[(C_CASHLINE_ID IS NULL) OR (C_BANKSTATEMENTLINE_ID IS NULL)]]></check>
       <check name="DIRECTPOSTING_DEBT_PAYMENT_CHK"><![CDATA[(ISDIRECTPOSTING = 'N') OR (C_GLITEM_ID IS NOT NULL)]]></check>
+      <check name="ISPAID_CDEBTPAYMENT"><![CDATA[((C_SETTLEMENT_CANCEL_ID IS NOT NULL) OR (C_SETTLEMENT_GENERATE_ID IS NOT NULL)) OR (ISPAID = 'N')]]></check>
       <check name="ISPAID2_CDEBTPAYMENT"><![CDATA[((C_BANKSTATEMENTLINE_ID IS NULL) AND (C_CASHLINE_ID IS NULL)) OR (ISPAID = 'Y')]]></check>
-      <check name="ISPAID_CDEBTPAYMENT"><![CDATA[((C_SETTLEMENT_CANCEL_ID IS NOT NULL) OR (C_SETTLEMENT_GENERATE_ID IS NOT NULL)) OR (ISPAID = 'N')]]></check>
       <check name="ISVALIDACTIVE_DEBT_PAYMENT"><![CDATA[(ISVALID = 'N') OR (ISACTIVE = 'Y')]]></check>
       <check name="ISVALIDPLUS_DEBT_PAYMENT2"><![CDATA[(((ISVALID = 'Y') AND (((C_SETTLEMENT_GENERATE_ID IS NULL) AND (GENERATE_PROCESSED = 'N')) OR ((C_SETTLEMENT_GENERATE_ID IS NOT NULL) AND (GENERATE_PROCESSED = 'Y')))) OR (((ISVALID = 'N') AND (C_SETTLEMENT_GENERATE_ID IS NOT NULL)) AND (GENERATE_PROCESSED = 'N'))) OR ((ISVALID = 'N') AND (ISAUTOMATICGENERATED = 'N'))]]></check>
     </table>
--- a/database/model/tables/C_DISCOUNT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_DISCOUNT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,14 +13,14 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="120" autoIncrement="false"/>
       <column name="DISCOUNT" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"/>
       <column name="M_PRODUCT_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="CDISC_FK_ADCLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="CDISCOUNT_FK_ADORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="CDISCOUNT_FK_MPRODUCT">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="CDISC_FK_ADCLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
     </table>
   </database>
--- a/database/model/tables/C_DOCTYPE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_DOCTYPE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -40,6 +40,12 @@
       <column name="AD_TABLE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ORGFILTERED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="C_DOCTYPE_REVERSED_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_SEQUENCE" name="AD_SEQUENCE_DOCTYPEBATCH">
+        <reference local="BATCHNOSEQUENCE_ID" foreign="AD_SEQUENCE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_SEQUENCE" name="AD_SEQUENCE_DOCTYPEDOC">
+        <reference local="DOCNOSEQUENCE_ID" foreign="AD_SEQUENCE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CDOCTYPE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -52,11 +58,8 @@
       <foreign-key foreignTable="AD_TABLE" name="ADTABLE_CDOCTYPE">
         <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_SEQUENCE" name="AD_SEQUENCE_DOCTYPEBATCH">
-        <reference local="BATCHNOSEQUENCE_ID" foreign="AD_SEQUENCE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_SEQUENCE" name="AD_SEQUENCE_DOCTYPEDOC">
-        <reference local="DOCNOSEQUENCE_ID" foreign="AD_SEQUENCE_ID"/>
+      <foreign-key foreignTable="C_APPROVAL" name="C_APPROVAL_DOCTYPE">
+        <reference local="C_APPROVAL_ID" foreign="C_APPROVAL_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPE_INVOICE">
         <reference local="C_DOCTYPEINVOICE_ID" foreign="C_DOCTYPE_ID"/>
@@ -67,9 +70,6 @@
       <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPE_SHIPMENT">
         <reference local="C_DOCTYPESHIPMENT_ID" foreign="C_DOCTYPE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_APPROVAL" name="C_APPROVAL_DOCTYPE">
-        <reference local="C_APPROVAL_ID" foreign="C_APPROVAL_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="GL_CATEGORY" name="GLCATEGORY_CDOCTYPE">
         <reference local="GL_CATEGORY_ID" foreign="GL_CATEGORY_ID"/>
       </foreign-key>
@@ -77,15 +77,15 @@
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
       </unique>
-      <check name="CDOCTYPEISDOCNOCONTROL_CHECK"><![CDATA[ISDOCNOCONTROLLED IN ('Y', 'N')]]></check>
       <check name="CDOCTYPE_CREATEPICKLIST_CHECK"><![CDATA[CREATEPICKLIST IN ('Y', 'N')]]></check>
-      <check name="CDOCTYPE_ISBCONTRFORCED_CHECK"><![CDATA[ISBATCHCONTROLENFORCED IN ('Y', 'N')]]></check>
-      <check name="CDOCTYPE_ISBDOCNOCONTR_CHECK"><![CDATA[ISBATCHDOCNOCONTROLLED IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_HASCHARGES_CHECK"><![CDATA[HASCHARGES IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_HASPROFORMA_CHECK"><![CDATA[HASPROFORMA IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_ISAPPROVED_CHECK"><![CDATA[ISAPPROVED IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_ISBATCHED_CHECK"><![CDATA[ISBATCHED IN ('Y', 'N')]]></check>
+      <check name="CDOCTYPE_ISBCONTRFORCED_CHECK"><![CDATA[ISBATCHCONTROLENFORCED IN ('Y', 'N')]]></check>
+      <check name="CDOCTYPE_ISBDOCNOCONTR_CHECK"><![CDATA[ISBATCHDOCNOCONTROLLED IN ('Y', 'N')]]></check>
+      <check name="CDOCTYPEISDOCNOCONTROL_CHECK"><![CDATA[ISDOCNOCONTROLLED IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_ISMAXTABLE_CHECK"><![CDATA[ISMAXTABLE IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_ISPRINTED_CHECK"><![CDATA[ISPRINTED IN ('Y', 'N')]]></check>
       <check name="C_DOCTYPE_ISSOTRX_CHECK"><![CDATA[ISSOTRX IN ('Y', 'N')]]></check>
--- a/database/model/tables/C_DOCTYPE_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_DOCTYPE_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -26,7 +26,7 @@
       <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPE_CDOCTYPETRL" onDelete="cascade">
         <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
       </foreign-key>
+      <check name="C_DOCTYPE_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CDOCTYPETRL_ISTRANSLAT_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
-      <check name="C_DOCTYPE_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_DUNNING.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_DUNNING.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -20,7 +20,7 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CDUNNING">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <check name="C_DUNNING_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CDUN_SENDDUNLET_CHECK"><![CDATA[SENDDUNNINGLETTER IN ('Y', 'N')]]></check>
-      <check name="C_DUNNING_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_ELEMENT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_ELEMENT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -21,15 +21,15 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CELEMENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_TREE" name="ADTREE_CELEMENT" onDelete="setnull">
+        <reference local="AD_TREE_ID" foreign="AD_TREE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_TREE" name="ADTREE1_CELEMENT" onDelete="setnull">
         <reference local="ADD1TREE_ID" foreign="AD_TREE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_TREE" name="ADTREE2_CELEMENT" onDelete="setnull">
         <reference local="ADD2TREE_ID" foreign="AD_TREE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_TREE" name="ADTREE_CELEMENT" onDelete="setnull">
-        <reference local="AD_TREE_ID" foreign="AD_TREE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="C_ELEMENTORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
@@ -37,8 +37,8 @@
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
       </unique>
-      <check name="CELEM_ISNATURACCOUNT_CHECK"><![CDATA[ISNATURALACCOUNT IN ('Y', 'N')]]></check>
       <check name="C_ELEMENT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="C_ELEMENT_ISBALANCING_CHECK"><![CDATA[ISBALANCING IN ('Y', 'N')]]></check>
+      <check name="CELEM_ISNATURACCOUNT_CHECK"><![CDATA[ISNATURALACCOUNT IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_ELEMENTVALUE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_ELEMENTVALUE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -52,13 +52,13 @@
         <unique-column name="C_ELEMENT_ID"/>
         <unique-column name="VALUE"/>
       </unique>
-      <check name="CELEMVALUE_POSTACTUAL_CHECK"><![CDATA[POSTACTUAL IN ('Y', 'N')]]></check>
-      <check name="CELEMVALUE_POSTBUDGET_CHECK"><![CDATA[POSTBUDGET IN ('Y', 'N')]]></check>
+      <check name="C_ELEMENTVALUE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CELEMVAL_ISBANKACCOUNT_CHECK"><![CDATA[ISBANKACCOUNT IN ('Y', 'N')]]></check>
       <check name="CELEMVAL_ISDOCCONTROL_CHECK"><![CDATA[ISDOCCONTROLLED IN ('Y', 'N')]]></check>
       <check name="CELEMVAL_ISFORCURREN_CHECK"><![CDATA[ISFOREIGNCURRENCY IN ('Y', 'N')]]></check>
       <check name="CELEMVAL_POSTENCUMBR_CHECK"><![CDATA[POSTENCUMBRANCE IN ('Y', 'N')]]></check>
       <check name="CELEMVAL_POSTSTATISTIC_CHECK"><![CDATA[POSTSTATISTICAL IN ('Y', 'N')]]></check>
-      <check name="C_ELEMENTVALUE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="CELEMVALUE_POSTACTUAL_CHECK"><![CDATA[POSTACTUAL IN ('Y', 'N')]]></check>
+      <check name="CELEMVALUE_POSTBUDGET_CHECK"><![CDATA[POSTBUDGET IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_GREETING.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_GREETING.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -19,8 +19,8 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CGREETING">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <check name="CGREET_ISFIRSTNAMEONLY_CHECK"><![CDATA[ISFIRSTNAMEONLY IN ('Y', 'N')]]></check>
       <check name="C_GREETING_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="C_GREETING_ISDEFAULT_CHECK"><![CDATA[ISDEFAULT IN ('Y', 'N')]]></check>
+      <check name="CGREET_ISFIRSTNAMEONLY_CHECK"><![CDATA[ISFIRSTNAMEONLY IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_GREETING_TRL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_GREETING_TRL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -29,7 +29,7 @@
         <index-column name="C_GREETING_ID"/>
         <index-column name="AD_LANGUAGE"/>
       </index>
+      <check name="C_GREETING_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CGREET_TRL_ISTRANSLATED_CHECK"><![CDATA[ISTRANSLATED IN ('Y', 'N')]]></check>
-      <check name="C_GREETING_TRL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_INTERORG_ACCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_INTERORG_ACCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,12 +15,12 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CINTERORGACCT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_CINTERORGACCT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTO_CINTERORGACCT">
         <reference local="AD_ORGTO_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_CINTERORGACCT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_CINTERORGACCT" onDelete="cascade">
         <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
       </foreign-key>
--- a/database/model/tables/C_INVOICE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_INVOICE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -57,18 +57,21 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CINVOICE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_CINVOICE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTRX_CINVOICE">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_CINVOICE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_USER" name="ADUSER_CINVOICE">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_USER" name="ADUSER_SR_CINVOICE">
         <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BPARTNER_LOCATION" name="C_BPLOCATION_CINVOICE">
+        <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_CINVOICE">
         <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
       </foreign-key>
@@ -84,12 +87,12 @@
       <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_CINVOICE">
         <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPE_CINVOICE">
+        <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPETARGET_CINVOICE">
         <reference local="C_DOCTYPETARGET_ID" foreign="C_DOCTYPE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPE_CINVOICE">
-        <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ORDER" name="CORDER_CINVOICE">
         <reference local="C_ORDER_ID" foreign="C_ORDER_ID"/>
       </foreign-key>
@@ -99,9 +102,6 @@
       <foreign-key foreignTable="C_PROJECT" name="CPROJECT_CINVOICE">
         <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BPARTNER_LOCATION" name="C_BPLOCATION_CINVOICE">
-        <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_CINVOICE">
         <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
       </foreign-key>
--- a/database/model/tables/C_INVOICELINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_INVOICELINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -47,12 +47,12 @@
       <foreign-key foreignTable="C_CHARGE" name="CCHARGE_CINVOICELINE">
         <reference local="C_CHARGE_ID" foreign="C_CHARGE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_INVOICE" name="CINVOICE_CINVOICELINE">
+        <reference local="C_INVOICE_ID" foreign="C_INVOICE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_INVOICE_DISCOUNT" name="CINVOICELINE_FK_DISCINVOICE">
         <reference local="C_INVOICE_DISCOUNT_ID" foreign="C_INVOICE_DISCOUNT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_INVOICE" name="CINVOICE_CINVOICELINE">
-        <reference local="C_INVOICE_ID" foreign="C_INVOICE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ORDERLINE" name="CORDERLINE_CINVOICELINE">
         <reference local="C_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
       </foreign-key>
@@ -71,12 +71,12 @@
       <foreign-key foreignTable="M_OFFER" name="MOFFER_CINVOICELINE">
         <reference local="M_OFFER_ID" foreign="M_OFFER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CINVOICELINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_CINVOICELINE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CINVOICELINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_PROJECTLINE" name="PROJECTLINE_CINVOICELINE">
         <reference local="C_PROJECTLINE_ID" foreign="C_PROJECTLINE_ID"/>
       </foreign-key>
--- a/database/model/tables/C_LOCATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_LOCATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -24,15 +24,15 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CLOCATION">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_CITY" name="CCITY_CLOCATION">
-        <reference local="C_CITY_ID" foreign="C_CITY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_COUNTRY" name="C_COUNTRY_LOCATION">
         <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_REGION" name="C_REGION_LOCATION">
         <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_CITY" name="CCITY_CLOCATION">
+        <reference local="C_CITY_ID" foreign="C_CITY_ID"/>
+      </foreign-key>
       <check name="C_LOCATION_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_NATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_NATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,15 +13,15 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="C_COUNTRY_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="ISDEFAULT" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
-      <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_CNATION">
-        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="C_NATIONCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="C_NATIONORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_CNATION">
+        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
+      </foreign-key>
       <unique name="C_NATION_NAME">
         <unique-column name="C_COUNTRY_ID"/>
         <unique-column name="NAME"/>
--- a/database/model/tables/C_ORDER.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_ORDER.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -75,14 +75,11 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CORDER">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORGTRX_CORDER">
-        <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORG_CORDER">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_USER" name="ADUSERDROPSHIP_CORDER">
-        <reference local="DROPSHIP_USER_ID" foreign="AD_USER_ID"/>
+      <foreign-key foreignTable="AD_ORG" name="ADORGTRX_CORDER">
+        <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_USER" name="ADUSER_CORDER">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
@@ -90,18 +87,24 @@
       <foreign-key foreignTable="AD_USER" name="ADUSER_SR_CORDER">
         <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_USER" name="ADUSERDROPSHIP_CORDER">
+        <reference local="DROPSHIP_USER_ID" foreign="AD_USER_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_DOCTYPE" name="C_DOCTYPE_CORDER">
+        <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_CORDER">
         <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_CORDER">
+        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNERDROPSHIP_CORDER">
         <reference local="DROPSHIP_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPARTNERLOCATION_SOHEADER">
         <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_CORDER">
-        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPLOCATIONBILLTO_SOHEADER">
         <reference local="BILLTO_ID" foreign="C_BPARTNER_LOCATION_ID"/>
       </foreign-key>
@@ -129,9 +132,6 @@
       <foreign-key foreignTable="C_PROJECT" name="CPROJECT_CORDER">
         <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_DOCTYPE" name="C_DOCTYPE_CORDER">
-        <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_SOHEADER">
         <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
       </foreign-key>
@@ -156,11 +156,11 @@
       <index name="C_ORDER_UPDATED" unique="false">
         <index-column name="UPDATED"/>
       </index>
-      <check name="CORDER_ISCREDITAPPROVED_CHECK"><![CDATA[ISCREDITAPPROVED IN ('Y', 'N')]]></check>
-      <check name="CORDER_ISDISCOUNTPRINT_CHECK"><![CDATA[ISDISCOUNTPRINTED IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISAPPROVED_CHECK"><![CDATA[ISAPPROVED IN ('Y', 'N')]]></check>
+      <check name="CORDER_ISCREDITAPPROVED_CHECK"><![CDATA[ISCREDITAPPROVED IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISDELIVERED_CHECK"><![CDATA[ISDELIVERED IN ('Y', 'N')]]></check>
+      <check name="CORDER_ISDISCOUNTPRINT_CHECK"><![CDATA[ISDISCOUNTPRINTED IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISINVOICED_CHECK"><![CDATA[ISINVOICED IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISPRINTED_CHECK"><![CDATA[ISPRINTED IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISSELECTED_CHECK"><![CDATA[ISSELECTED IN ('Y', 'N')]]></check>
--- a/database/model/tables/C_ORDERLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_ORDERLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -54,12 +54,15 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CORDERLINE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPARTNERLOCATION_SOLINE">
-        <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
+      <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_SOPOREF">
+        <reference local="REF_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_SOLINE">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPARTNERLOCATION_SOLINE">
+        <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_CHARGE" name="CCHARGE_CORDERLINE">
         <reference local="C_CHARGE_ID" foreign="C_CHARGE_ID"/>
       </foreign-key>
@@ -75,21 +78,18 @@
       <foreign-key foreignTable="C_UOM" name="CUOM_CORDERLINE">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_SOPOREF">
-        <reference local="REF_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRSETINST_CORDERLINE">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_OFFER" name="MOFFER_CORDERLINE">
         <reference local="M_OFFER_ID" foreign="M_OFFER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CORDERLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTOUMID_CORDERLINE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CORDERLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_SHIPPER" name="MSHIPPER_CORDERLINE">
         <reference local="M_SHIPPER_ID" foreign="M_SHIPPER_ID"/>
       </foreign-key>
--- a/database/model/tables/C_PAYMENTTERM.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_PAYMENTTERM.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -41,8 +41,8 @@
         <unique-column name="NAME"/>
       </unique>
       <check name="CPAYMENTT_AFTERDELIVERY_CHECK"><![CDATA[AFTERDELIVERY IN ('Y', 'N')]]></check>
+      <check name="C_PAYMENTTERM_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CPAYMENTT_ISDUEFIXED_CHECK"><![CDATA[ISDUEFIXED IN ('Y', 'N')]]></check>
       <check name="CPAYMENTT_ISNEXTBUSDAY_CHECK"><![CDATA[ISNEXTBUSINESSDAY IN ('Y', 'N')]]></check>
-      <check name="C_PAYMENTTERM_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_PAYMENTTERMLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_PAYMENTTERMLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -33,8 +33,8 @@
       <foreign-key foreignTable="C_PAYMENTTERM" name="CPAYMENTTERM_CPAYMENTTERMLINE">
         <reference local="C_PAYMENTTERM_ID" foreign="C_PAYMENTTERM_ID"/>
       </foreign-key>
+      <check name="CPAYMENTTL_EXCLUDETAX_CHECK"><![CDATA[EXCLUDETAX IN ('Y', 'N')]]></check>
       <check name="CPAYMENTTLINE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
-      <check name="CPAYMENTTL_EXCLUDETAX_CHECK"><![CDATA[EXCLUDETAX IN ('Y', 'N')]]></check>
       <check name="CPAYMENTTL_ISDUEFIXED_CHECK"><![CDATA[ISDUEFIXED IN ('Y', 'N')]]></check>
       <check name="CPAYMENTTL_ISNEXTBUSDAY_CHECK"><![CDATA[ISNEXTBUSINESSDAY IN ('Y', 'N')]]></check>
       <check name="CPAYMENTTL_ONREMAINDER_CHECK"><![CDATA[ONREMAINDER IN ('Y', 'N')]]></check>
--- a/database/model/tables/C_PROJECT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_PROJECT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -78,6 +78,9 @@
       <foreign-key foreignTable="AD_USER" name="ADUSER_SR_CPROJECT">
         <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_LOCATION" name="C_LOCATION_PROJECT">
+        <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_CPROJECT">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
@@ -102,9 +105,6 @@
       <foreign-key foreignTable="C_PROJECTTYPE" name="CPROJECTTYPE_CPROJECT">
         <reference local="C_PROJECTTYPE_ID" foreign="C_PROJECTTYPE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_LOCATION" name="C_LOCATION_PROJECT">
-        <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRICELIST_VERSION" name="MPRICELISTVERSION_CPROJECT">
         <reference local="M_PRICELIST_VERSION_ID" foreign="M_PRICELIST_VERSION_ID"/>
       </foreign-key>
--- a/database/model/tables/C_PROJECTLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_PROJECTLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -39,27 +39,27 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CPROJECTLINE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_TAX" name="C_TAX_FK_PROJECTLINE">
+        <reference local="C_TAX_ID" foreign="C_TAX_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ORDER" name="CORDER_CPROJECTLINE">
         <reference local="C_ORDERPO_ID" foreign="C_ORDER_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_ORDER" name="CORDER_CPROJECTLINE1">
         <reference local="C_ORDER_ID" foreign="C_ORDER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_PROJECT" name="CPROJECT_CPROJECTLINE" onDelete="cascade">
+        <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_PROJECTISSUE" name="CPROJECTISSUE_CPROJECTLINE">
         <reference local="C_PROJECTISSUE_ID" foreign="C_PROJECTISSUE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_PROJECT" name="CPROJECT_CPROJECTLINE" onDelete="cascade">
-        <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_TAX" name="C_TAX_FK_PROJECTLINE">
-        <reference local="C_TAX_ID" foreign="C_TAX_ID"/>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CPROJECTLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="MPRODUCTCAT_CPROJECTLINE">
         <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CPROJECTLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <check name="C_PROJECTLINE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_PROJECTPROPOSAL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_PROJECTPROPOSAL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -30,6 +30,9 @@
       <foreign-key foreignTable="AD_USER" name="ADUSER_C_PROJECTPROPOSAL" onDelete="setnull">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_PAYMENTTERM" name="C_PAYMENTTERM_C_PPROPOSAL">
+        <reference local="C_PAYMENTTERM_ID" foreign="C_PAYMENTTERM_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_C_PROJECTPROPOSAL">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
@@ -39,9 +42,6 @@
       <foreign-key foreignTable="C_PROJECT" name="CPROJECT_C_PROJECTPROPOSAL">
         <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_PAYMENTTERM" name="C_PAYMENTTERM_C_PPROPOSAL">
-        <reference local="C_PAYMENTTERM_ID" foreign="C_PAYMENTTERM_ID"/>
-      </foreign-key>
       <check name="C_PROJECTPROPOS_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_PROJECT_ACCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_PROJECT_ACCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -18,12 +18,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CPROJECTACCT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_PROJECT" name="C_PROJECT_PROJECTACCT" onDelete="cascade">
+        <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_CPROJECTACCT" onDelete="cascade">
         <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_PROJECT" name="C_PROJECT_PROJECTACCT" onDelete="cascade">
-        <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="VC_PJASSET_CPROJECT">
         <reference local="PJ_ASSET_ACCT" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
--- a/database/model/tables/C_REGION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_REGION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,9 +15,6 @@
       <column name="ISDEFAULT" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="C_NATION_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="VALUE" primaryKey="false" required="false" type="CHAR" size="2" autoIncrement="false"/>
-      <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_CREGION">
-        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="C_REGIONCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -27,6 +24,9 @@
       <foreign-key foreignTable="AD_ORG" name="C_REGIONORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_CREGION">
+        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
+      </foreign-key>
       <unique name="C_REGION_NAME">
         <unique-column name="C_COUNTRY_ID"/>
         <unique-column name="NAME"/>
--- a/database/model/tables/C_REMITTANCE_TYPE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_REMITTANCE_TYPE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,12 +15,12 @@
       <column name="PAYMENTRULECONSOLIDATED" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="STATUS_RETURNED" primaryKey="false" required="false" type="CHAR" size="2" autoIncrement="false"/>
       <column name="ISRECEIPT" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_CREMITTANCETYPE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_CREMITTANCETYPE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_CREMITTANCETYPE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="C_REMITTANCE_TY_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_SERVICELEVEL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_SERVICELEVEL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -28,7 +28,7 @@
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_CSERVICELEVEL">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
+      <check name="C_SERVICELEVEL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CSERVICELEVEL_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
-      <check name="C_SERVICELEVEL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_SETTLEMENT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_SETTLEMENT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -57,9 +57,9 @@
       <index name="C_SETTLEMENT_UPDATED" unique="false">
         <index-column name="UPDATED"/>
       </index>
-      <check name="CSETTLEMENT_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
       <check name="CSETTLEM_CREATEFILE_CHECK"><![CDATA[CREATEFILE IN ('Y', 'N')]]></check>
       <check name="C_SETTLEMENT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="CSETTLEMENT_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
       <check name="DATEACCT_CSETTLEMENT"><![CDATA[DATEACCT IS NOT NULL]]></check>
     </table>
   </database>
--- a/database/model/tables/C_TAX.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_TAX.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -36,8 +36,17 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_CTAX">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_TAXCATEGORY" name="CTAXCATEGORY_CTAX" onDelete="cascade">
-        <reference local="C_TAXCATEGORY_ID" foreign="C_TAXCATEGORY_ID"/>
+      <foreign-key foreignTable="C_COUNTRY" name="C_COUNTRY_C_TAX">
+        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_COUNTRY" name="C_COUNTRYTO_C_TAX">
+        <reference local="TO_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_REGION" name="C_REGION_C_TAX">
+        <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_REGION" name="C_REGIONTO_C_TAX">
+        <reference local="TO_REGION_ID" foreign="C_REGION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BP_TAXCATEGORY" name="CTAX_CBPTAXCATEGORY">
         <reference local="C_BP_TAXCATEGORY_ID" foreign="C_BP_TAXCATEGORY_ID"/>
@@ -45,26 +54,17 @@
       <foreign-key foreignTable="C_TAX" name="CTAX_PARENT">
         <reference local="PARENT_TAX_ID" foreign="C_TAX_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_COUNTRY" name="C_COUNTRYTO_C_TAX">
-        <reference local="TO_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_COUNTRY" name="C_COUNTRY_C_TAX">
-        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_REGION" name="C_REGIONTO_C_TAX">
-        <reference local="TO_REGION_ID" foreign="C_REGION_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_REGION" name="C_REGION_C_TAX">
-        <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
+      <foreign-key foreignTable="C_TAXCATEGORY" name="CTAXCATEGORY_CTAX" onDelete="cascade">
+        <reference local="C_TAXCATEGORY_ID" foreign="C_TAXCATEGORY_ID"/>
       </foreign-key>
       <unique name="C_TAX_NAME1">
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
         <unique-column name="PARENT_TAX_ID"/>
       </unique>
-      <check name="CTAX_REQTAXCERTIFIC_CHECK"><![CDATA[REQUIRESTAXCERTIFICATE IN ('Y', 'N')]]></check>
       <check name="C_TAX_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="C_TAX_ISDOCUMENTLEVEL_CHECK"><![CDATA[ISDOCUMENTLEVEL IN ('Y', 'N')]]></check>
       <check name="C_TAX_ISPRINTTAX_CHECK"><![CDATA[ISPRINTTAX IN ('Y', 'N')]]></check>
+      <check name="CTAX_REQTAXCERTIFIC_CHECK"><![CDATA[REQUIRESTAXCERTIFICATE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_UOM_CONVERSION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_UOM_CONVERSION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,18 +13,18 @@
       <column name="C_UOM_TO_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MULTIPLYRATE" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
       <column name="DIVIDERATE" primaryKey="false" required="true" type="DECIMAL" default="0" autoIncrement="false"/>
-      <foreign-key foreignTable="C_UOM" name="CUOM_CUOMCONVERSION">
-        <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_UOM" name="C_UOMCONVERSIONTO">
-        <reference local="C_UOM_TO_ID" foreign="C_UOM_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="C_UOM_CONVERSIONCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="C_UOM_CONVERSIONORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_UOM" name="C_UOMCONVERSIONTO">
+        <reference local="C_UOM_TO_ID" foreign="C_UOM_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_UOM" name="CUOM_CUOMCONVERSION">
+        <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
+      </foreign-key>
       <check name="C_UOM_CONVERSIO_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/C_VALIDCOMBINATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_VALIDCOMBINATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -29,12 +29,12 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_VC">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_VC">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTRX_VC">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_VC">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_CVALIDCOMBINATION" onDelete="cascade">
         <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
       </foreign-key>
--- a/database/model/tables/C_WITHHOLDING.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/C_WITHHOLDING.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -35,10 +35,10 @@
       <foreign-key foreignTable="C_PAYMENTTERM" name="CPAYMENTTERM_CWITHHOLDING">
         <reference local="C_PAYMENTTERM_ID" foreign="C_PAYMENTTERM_ID"/>
       </foreign-key>
+      <check name="C_WITHHOLDING_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="CWITHHOLD_ISTAXPRORAT_CHECK"><![CDATA[ISTAXPRORATED IN ('Y', 'N')]]></check>
       <check name="CWITHOLD_ISPAIDTO3PART_CHECK"><![CDATA[ISPAIDTO3PARTY IN ('Y', 'N')]]></check>
       <check name="CWITHOLD_ISPNTWITHOLD_CHECK"><![CDATA[ISPERCENTWITHHOLDING IN ('Y', 'N')]]></check>
       <check name="CWITHOLD_ISTAXWITHHOLD_CHECK"><![CDATA[ISTAXWITHHOLDING IN ('Y', 'N')]]></check>
-      <check name="C_WITHHOLDING_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/FACT_ACCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/FACT_ACCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -55,35 +55,14 @@
       <foreign-key foreignTable="AD_CLIENT" name="AC_CLIENT_FACT_ACCT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_TABLE" name="ADTABLE_FACTACCT">
-        <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_FACT_ACCT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORGTRX_FACT_ACCT">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_FACT_ACCT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_FACTACCT" onDelete="cascade">
-        <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_FACTACCT">
-        <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER1_FACTACCT">
-        <reference local="USER1_ID" foreign="C_ELEMENTVALUE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER2_FACTACCT">
-        <reference local="USER2_ID" foreign="C_ELEMENTVALUE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUE_FACTACCT">
-        <reference local="ACCOUNT_ID" foreign="C_ELEMENTVALUE_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_PERIOD" name="CPERIOD_FACTACCT">
-        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_TAX" name="CTAX_FACTACCT">
-        <reference local="C_TAX_ID" foreign="C_TAX_ID"/>
+      <foreign-key foreignTable="AD_TABLE" name="ADTABLE_FACTACCT">
+        <reference local="AD_TABLE_ID" foreign="AD_TABLE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="C_BUSPARTNER_FACT_ACCT">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
@@ -106,18 +85,39 @@
       <foreign-key foreignTable="C_UOM" name="C_UOM_FACT_ACCT">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_FACTACCT" onDelete="cascade">
+        <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_FACTACCT">
+        <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUE_FACTACCT">
+        <reference local="ACCOUNT_ID" foreign="C_ELEMENTVALUE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER1_FACTACCT">
+        <reference local="USER1_ID" foreign="C_ELEMENTVALUE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUEUSER2_FACTACCT">
+        <reference local="USER2_ID" foreign="C_ELEMENTVALUE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_PERIOD" name="CPERIOD_FACTACCT">
+        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_TAX" name="CTAX_FACTACCT">
+        <reference local="C_TAX_ID" foreign="C_TAX_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="GL_BUDGET" name="GLBUDGET_FACTACCT">
         <reference local="GL_BUDGET_ID" foreign="GL_BUDGET_ID"/>
       </foreign-key>
       <foreign-key foreignTable="GL_CATEGORY" name="GLCATEGORY_FACTACCT">
         <reference local="GL_CATEGORY_ID" foreign="GL_CATEGORY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_FACT_ACCT">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_FACTACCT">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_FACT_ACCT">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_CAMPAIGN" name="SO_CAMPAIGN_FACT_ACCT">
         <reference local="C_CAMPAIGN_ID" foreign="C_CAMPAIGN_ID"/>
       </foreign-key>
--- a/database/model/tables/FACT_ACCT_BALANCE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/FACT_ACCT_BALANCE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -29,12 +29,12 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_FACTACCTBAL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_FACTACCTBAL" onDelete="cascade">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTRX_FACTACCTBAL">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_FACTACCTBAL" onDelete="cascade">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_FACTACCTBAL">
         <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
       </foreign-key>
--- a/database/model/tables/GL_JOURNAL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/GL_JOURNAL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -40,18 +40,18 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_GLJOURNAL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ACCTSCHEMA" name="C_ACCTSCHEMA_GL_JOURNAL">
+        <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_PERIOD" name="C_PERIOD_JOURNAL">
+        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_GLJOURNAL">
         <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_DOCTYPE" name="CDOCTYPE_GLJOURNAL">
         <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ACCTSCHEMA" name="C_ACCTSCHEMA_GL_JOURNAL">
-        <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_PERIOD" name="C_PERIOD_JOURNAL">
-        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="GL_BUDGET" name="GLBUDGET_GLJOURNAL">
         <reference local="GL_BUDGET_ID" foreign="GL_BUDGET_ID"/>
       </foreign-key>
--- a/database/model/tables/GL_JOURNALBATCH.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/GL_JOURNALBATCH.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -30,12 +30,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_GLJOURNALBATCH">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_PERIOD" name="C_PERIOD_JOURNALBATCH">
+        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_GLJOURNALBATCH">
         <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_PERIOD" name="C_PERIOD_JOURNALBATCH">
-        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="GL_CATEGORY" name="GLCATEGORY_GLJOURNALBATCH">
         <reference local="GL_CATEGORY_ID" foreign="GL_CATEGORY_ID"/>
       </foreign-key>
@@ -44,8 +44,8 @@
         <unique-column name="C_PERIOD_ID"/>
         <unique-column name="DOCUMENTNO"/>
       </unique>
+      <check name="GL_JOURNALBATCH_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="GLJOURNBATCH_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
       <check name="GLJOURNBATCH_PROCESSING_CHECK"><![CDATA[PROCESSING IN ('Y', 'N')]]></check>
-      <check name="GL_JOURNALBATCH_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/GL_JOURNALLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/GL_JOURNALLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -46,7 +46,7 @@
       <foreign-key foreignTable="GL_JOURNAL" name="GLJOURNAL_GLJOURNALLINE">
         <reference local="GL_JOURNAL_ID" foreign="GL_JOURNAL_ID"/>
       </foreign-key>
+      <check name="GL_JOURNALLINE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="GLJOURNLINE_ISGENERATED_CHECK"><![CDATA[ISGENERATED IN ('Y', 'N')]]></check>
-      <check name="GL_JOURNALLINE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/I_BANKSTATEMENT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_BANKSTATEMENT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -67,9 +67,9 @@
       <foreign-key foreignTable="C_INVOICE" name="CINVOICE_IBANKSTATEMENT">
         <reference local="C_INVOICE_ID" foreign="C_INVOICE_ID"/>
       </foreign-key>
+      <check name="I_BANKSTATEMENT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="IBANKSTAT_I_ISIMPORTED_CHECK"><![CDATA[I_ISIMPORTED IN ('Y', 'N')]]></check>
       <check name="IBANKSTAT_ISREVERSAL_CHECK"><![CDATA[ISREVERSAL IN ('Y', 'N')]]></check>
-      <check name="IBANKSTAT_I_ISIMPORTED_CHECK"><![CDATA[I_ISIMPORTED IN ('Y', 'N')]]></check>
       <check name="IBANKSTAT_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
-      <check name="I_BANKSTATEMENT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/I_BPARTNER.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_BPARTNER.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -55,12 +55,12 @@
       <foreign-key foreignTable="AD_USER" name="ADUSER_IBPARTNER">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_IBPARTNER">
+        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPARTNERLOCATION_IBPARTNER">
         <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_IBPARTNER">
-        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BP_GROUP" name="CBPGROUP_IBPARTNER">
         <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
       </foreign-key>
@@ -73,7 +73,7 @@
       <foreign-key foreignTable="C_REGION" name="CREGION_IBPARTNER">
         <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
       </foreign-key>
+      <check name="I_BPARTNER_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="IBPARTNER_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
-      <check name="I_BPARTNER_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/I_BUDGETLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_BUDGETLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -48,20 +48,11 @@
       <foreign-key foreignTable="AD_CLIENT" name="AC_CLIENT_I_BUDGETLINE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORGTRX_I_BUDGETLINE">
-        <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_I_BUDGETLINE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_I_BUDGETLINE">
-        <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_BUDGET" name="CBUDGET_IBUDGETLINE">
-        <reference local="C_BUDGET_ID" foreign="C_BUDGET_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="C_PERIOD" name="CPERIOD_IBUDGETLINE">
-        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORGTRX_I_BUDGETLINE">
+        <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BP_GROUP" name="C_BP_GROUP_I_BUDGETLINE">
         <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
@@ -87,6 +78,15 @@
       <foreign-key foreignTable="C_VALIDCOMBINATION" name="C_VALIDCOMBINATION_IBUDGETLINE">
         <reference local="C_VALIDCOMBINATION_ID" foreign="C_VALIDCOMBINATION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_I_BUDGETLINE">
+        <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_BUDGET" name="CBUDGET_IBUDGETLINE">
+        <reference local="C_BUDGET_ID" foreign="C_BUDGET_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_PERIOD" name="CPERIOD_IBUDGETLINE">
+        <reference local="C_PERIOD_ID" foreign="C_PERIOD_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="M_PRODUCT_CATEGORY_IBUDGETLINE">
         <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
       </foreign-key>
--- a/database/model/tables/I_ELEMENTVALUE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_ELEMENTVALUE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -42,21 +42,21 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_IELEMENTVALUE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ELEMENT" name="CELEMENT_IELEMENTVALUE">
+        <reference local="C_ELEMENT_ID" foreign="C_ELEMENT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUE_IELEMENTVALUE">
         <reference local="C_ELEMENTVALUE_ID" foreign="C_ELEMENTVALUE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ELEMENT" name="CELEMENT_IELEMENTVALUE">
-        <reference local="C_ELEMENT_ID" foreign="C_ELEMENT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ELEMENTVALUE" name="CEVALUEPARENT_IELEMENTVALUE">
         <reference local="PARENTELEMENTVALUE_ID" foreign="C_ELEMENTVALUE_ID"/>
       </foreign-key>
+      <check name="I_ELEMENTVALUE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="IELEMVAL_ISDOCCONTROL_CHECK"><![CDATA[ISDOCCONTROLLED IN ('Y', 'N')]]></check>
       <check name="IELEMVALUE_POSTACTUAL_CHECK"><![CDATA[POSTACTUAL IN ('Y', 'N')]]></check>
       <check name="IELEMVALUE_POSTBUDGET_CHECK"><![CDATA[POSTBUDGET IN ('Y', 'N')]]></check>
       <check name="IELEMVALUE_POSTENCUMBR_CHECK"><![CDATA[POSTENCUMBRANCE IN ('Y', 'N')]]></check>
       <check name="IELEMVALUE_POSTSTATIST_CHECK"><![CDATA[POSTSTATISTICAL IN ('Y', 'N')]]></check>
       <check name="IELEMVALUE_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
-      <check name="IELEMVAL_ISDOCCONTROL_CHECK"><![CDATA[ISDOCCONTROLLED IN ('Y', 'N')]]></check>
-      <check name="I_ELEMENTVALUE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/I_GLJOURNAL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_GLJOURNAL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -67,15 +67,15 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_IGLJOURNAL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_IGLJOURNAL">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGDOC_IGLJOURNAL">
         <reference local="AD_ORGDOC_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTRX_IGLJOURNAL">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_IGLJOURNAL">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ACCTSCHEMA" name="CACCTSCHEMA_IGLJOURNAL">
         <reference local="C_ACCTSCHEMA_ID" foreign="C_ACCTSCHEMA_ID"/>
       </foreign-key>
@@ -133,12 +133,12 @@
       <foreign-key foreignTable="GL_JOURNALLINE" name="GLJOURBELLINE_IGLJOURNAL">
         <reference local="GL_JOURNALLINE_ID" foreign="GL_JOURNALLINE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="GL_JOURNAL" name="GLJOURNAL_IGLJOURNAL">
+        <reference local="GL_JOURNAL_ID" foreign="GL_JOURNAL_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="GL_JOURNALBATCH" name="GLJOURNALBATCH_IGLJOURNAL">
         <reference local="GL_JOURNALBATCH_ID" foreign="GL_JOURNALBATCH_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="GL_JOURNAL" name="GLJOURNAL_IGLJOURNAL">
-        <reference local="GL_JOURNAL_ID" foreign="GL_JOURNAL_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_OGLJOURNAL">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
--- a/database/model/tables/I_INVENTORY.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_INVENTORY.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -37,12 +37,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_IINVENTORY">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_INVENTORY" name="MINVENTORY_IINVENTORY">
+        <reference local="M_INVENTORY_ID" foreign="M_INVENTORY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_INVENTORYLINE" name="MINVENTORYLINE_IINVENTORY">
         <reference local="M_INVENTORYLINE_ID" foreign="M_INVENTORYLINE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_INVENTORY" name="MINVENTORY_IINVENTORY">
-        <reference local="M_INVENTORY_ID" foreign="M_INVENTORY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_IINVENTORY">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
--- a/database/model/tables/I_INVOICE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_INVOICE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -59,12 +59,12 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_IINVOICE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_IINVOICE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTRX_IINVOICE">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_IINVOICE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_USER" name="ADUSER_IINVOICE">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
@@ -119,9 +119,9 @@
       <foreign-key foreignTable="AD_USER" name="REFAD_USER1974">
         <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <check name="I_INVOICE_I_ISIMPORTED_CHECK"><![CDATA[I_ISIMPORTED IN ('Y', 'N')]]></check>
       <check name="I_INVOICE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="I_INVOICE_ISSOTRX_CHECK"><![CDATA[ISSOTRX IN ('Y', 'N')]]></check>
-      <check name="I_INVOICE_I_ISIMPORTED_CHECK"><![CDATA[I_ISIMPORTED IN ('Y', 'N')]]></check>
       <check name="I_INVOICE_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/I_ORDER.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_ORDER.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -76,30 +76,30 @@
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_IORDER">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="ADORG_IORDER">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ADORGTRX_IORDER">
         <reference local="AD_ORGTRX_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="ADORG_IORDER">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="AD_USER" name="ADUSER_IORDER">
+        <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_USER" name="ADUSERSALESREP_IORDER">
         <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_USER" name="ADUSER_IORDER">
-        <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_ACTIVITY" name="CACTIVITY_IORDER">
         <reference local="C_ACTIVITY_ID" foreign="C_ACTIVITY_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBOLOCATION_IORDER">
         <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_IORDER">
+        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER_LOCATION" name="CBPARTNERLOCBILLTO_IORDER">
         <reference local="BILLTO_ID" foreign="C_BPARTNER_LOCATION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_IORDER">
-        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_CAMPAIGN" name="CCAMPAIGN_IORDER">
         <reference local="C_CAMPAIGN_ID" foreign="C_CAMPAIGN_ID"/>
       </foreign-key>
@@ -115,12 +115,12 @@
       <foreign-key foreignTable="C_LOCATION" name="CLOCATION_IORDER">
         <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ORDER" name="CORDER_IORDER">
+        <reference local="C_ORDER_ID" foreign="C_ORDER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_ORDERLINE" name="CORDERLINE_IORDER">
         <reference local="C_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ORDER" name="CORDER_IORDER">
-        <reference local="C_ORDER_ID" foreign="C_ORDER_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_PAYMENTTERM" name="CPAYMENTTERM_IORDER">
         <reference local="C_PAYMENTTERM_ID" foreign="C_PAYMENTTERM_ID"/>
       </foreign-key>
@@ -148,9 +148,9 @@
       <foreign-key foreignTable="C_PROJECT" name="REFC_PROJECT1959">
         <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
       </foreign-key>
+      <check name="I_ORDER_I_ISIMPORTED_CHECK"><![CDATA[I_ISIMPORTED IN ('Y', 'N', 'E')]]></check>
       <check name="I_ORDER_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="I_ORDER_ISSOTRX_CHECK"><![CDATA[ISSOTRX IN ('Y', 'N')]]></check>
-      <check name="I_ORDER_I_ISIMPORTED_CHECK"><![CDATA[I_ISIMPORTED IN ('Y', 'N', 'E')]]></check>
       <check name="I_ORDER_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/I_PRODUCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_PRODUCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -67,14 +67,14 @@
       <foreign-key foreignTable="C_UOM" name="CUOM_IPRODUCT">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_IPRODUCT">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="MPRODUCTCATEGORY_IPRODUCT">
         <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_IPRODUCT">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
+      <check name="I_PROD_DISCONTINUED_CHECK"><![CDATA[DISCONTINUED IN ('Y', 'N')]]></check>
       <check name="I_PRODUCT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="I_PRODUCT_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
-      <check name="I_PROD_DISCONTINUED_CHECK"><![CDATA[DISCONTINUED IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/I_REPORTLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_REPORTLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -37,12 +37,12 @@
       <foreign-key foreignTable="C_ELEMENTVALUE" name="CELEMENTVALUE_IREPORTLINE">
         <reference local="C_ELEMENTVALUE_ID" foreign="C_ELEMENTVALUE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="PA_REPORTLINE" name="PAREPORTLINE_IREPORTLINE">
+        <reference local="PA_REPORTLINE_ID" foreign="PA_REPORTLINE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="PA_REPORTLINESET" name="PAREPORTLINESET_IREPORTLINE">
         <reference local="PA_REPORTLINESET_ID" foreign="PA_REPORTLINESET_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="PA_REPORTLINE" name="PAREPORTLINE_IREPORTLINE">
-        <reference local="PA_REPORTLINE_ID" foreign="PA_REPORTLINE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="PA_REPORTSOURCE" name="PAREPORTSOURCE_IREPORTLINE">
         <reference local="PA_REPORTSOURCE_ID" foreign="PA_REPORTSOURCE_ID"/>
       </foreign-key>
--- a/database/model/tables/I_TAX.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/I_TAX.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -53,21 +53,21 @@
       <foreign-key foreignTable="C_COUNTRY" name="COUTRYTO_ITAX">
         <reference local="TO_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_TAX" name="CTAX_ITAX">
+        <reference local="C_TAX_ID" foreign="C_TAX_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_TAX" name="CTAX1_ITAX">
         <reference local="PARENT_TAX_ID" foreign="C_TAX_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_TAX" name="CTAX_ITAX">
-        <reference local="C_TAX_ID" foreign="C_TAX_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="ORG_ITAX">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_REGION" name="REGION_ITAX">
+        <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_REGION" name="REGIONTO_ITAX">
         <reference local="TO_REGION_ID" foreign="C_REGION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_REGION" name="REGION_ITAX">
-        <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_TAXCATEGORY" name="TAXCATEGORY_ITAX">
         <reference local="C_TAXCATEGORY_ID" foreign="C_TAXCATEGORY_ID"/>
       </foreign-key>
--- a/database/model/tables/K_ENTRYCATEGORY.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/K_ENTRYCATEGORY.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -17,12 +17,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_KENTRYCATEGORY">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="K_CATEGORY" name="KCATEGORY_KENTRYCATEGORY">
+        <reference local="K_CATEGORY_ID" foreign="K_CATEGORY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="K_CATEGORYVALUE" name="KCATEGORYVALUE_KENTRYCATEGORY">
         <reference local="K_CATEGORYVALUE_ID" foreign="K_CATEGORYVALUE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="K_CATEGORY" name="KCATEGORY_KENTRYCATEGORY">
-        <reference local="K_CATEGORY_ID" foreign="K_CATEGORY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="K_ENTRY" name="KENTRY_KENTRYCATALOG">
         <reference local="K_ENTRY_ID" foreign="K_ENTRY_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_CALCSTD.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_CALCSTD.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,12 +14,12 @@
       <column name="DATETO" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="MA_PROCESSPLAN_VERSION_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="C_BUDGET_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACALCSTD">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACALCSTD">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACALCSTD">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BUDGET" name="C_BUDGET_MA_CALCSTD">
         <reference local="C_BUDGET_ID" foreign="C_BUDGET_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_CCP.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_CCP.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,12 +16,12 @@
       <column name="VALUENUMBER" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"/>
       <column name="MA_CCP_GROUP_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="SEQNO" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACCP">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACCP">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACCP">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_CCP_GROUP" name="MA_CCP_GROUP_MACCP">
         <reference local="MA_CCP_GROUP_ID" foreign="MA_CCP_GROUP_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_CCP_GROUP.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_CCP_GROUP.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,12 +14,12 @@
       <column name="FRECUENCY" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="SEQNO" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="HASSECPRODUCT" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACCPGROUP">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACCPGROUP">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACCPGROUP">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MACCPGR_HASSECPRODUCT_CHECK"><![CDATA[HASSECPRODUCT IN ('Y', 'N')]]></check>
       <check name="MA_CCP_GROUP_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/MA_CCP_SHIFT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_CCP_SHIFT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,12 +13,12 @@
       <column name="STARTTIME" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="ENDTIME" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="SHIFT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACCPSHIFT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACCPSHIFT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACCPSHIFT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_CCP_GROUP" name="MA_CCP_GROUP_MACCPSHIFT">
         <reference local="MA_CCP_GROUP_ID" foreign="MA_CCP_GROUP_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_CONSUMEPRODUCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_CONSUMEPRODUCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,12 +11,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="M_PRODUCT_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACONSUMEPRODUCT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACONSUMEPRODUCT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACONSUMEPRODUCT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MACONSUMEPRODUCT">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_CONSUMERM.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_CONSUMERM.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,12 +12,12 @@
       <column name="MA_CONSUMEPRODUCT_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="M_PRODUCT_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACONSUMERM">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACONSUMERM">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACONSUMERM">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_CONSUMEPRODUCT" name="MACONSUME_MACONSUMERM">
         <reference local="MA_CONSUMEPRODUCT_ID" foreign="MA_CONSUMEPRODUCT_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_COSTCENTER.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_COSTCENTER.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -15,12 +15,12 @@
       <column name="BYDEFAULT" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="CALCULATED" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="COSTUOM" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACOSTCENTER">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACOSTCENTER">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACOSTCENTER">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_COSTCENTER_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_COSTCENTER_VERSION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_COSTCENTER_VERSION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,12 +14,12 @@
       <column name="MA_COSTCENTER_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="COSTUOM" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="VALIDFROM" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACOSTCENTER_VERSION">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MACOSTCENTER_VERSION">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MACOSTCENTER_VERSION">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_COSTCENTER" name="COSTCENTER_COSTCENTERVERSION">
         <reference local="MA_COSTCENTER_ID" foreign="MA_COSTCENTER_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_DEFAULTPLAN.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_DEFAULTPLAN.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -10,18 +10,18 @@
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_PROCESSPLAN_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MADEFAULTPLAN">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MADEFAULTPLAN">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MADEFAULTPLAN">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MADEFAULTPLAN">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_PROCESSPLAN" name="MA_PROCESSPLAN_MADEFAULTPLAN">
         <reference local="MA_PROCESSPLAN_ID" foreign="MA_PROCESSPLAN_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MADEFAULTPLAN">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <check name="MA_DEFAULTPLAN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_GLOBALUSE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_GLOBALUSE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -32,15 +32,15 @@
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MAGLOBALUSE">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MAGLOBALUSE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCTION" name="MPRODUCTION_MAGLOBALUSE">
         <reference local="M_PRODUCTION_ID" foreign="M_PRODUCTION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MAGLOBALUSE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MAGLOBALUSE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <check name="MA_GLOBALUSE_CHECK1"><![CDATA[((QUANTITYORDER IS NULL) AND (M_PRODUCT_UOM_ID IS NULL)) OR ((QUANTITYORDER IS NOT NULL) AND (M_PRODUCT_UOM_ID IS NOT NULL))]]></check>
       <check name="MA_GLOBALUSE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/MA_INCIDENCE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_INCIDENCE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,12 +12,12 @@
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="STRTIME" primaryKey="false" required="false" type="NVARCHAR" size="10" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAINCIDENCE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAINCIDENCE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAINCIDENCE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_INCIDENCE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_INDIRECT_COST.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_INDIRECT_COST.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,12 +12,12 @@
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="COST_TYPE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAINDIRECT_COST">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAINDIRECT_COST">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAINDIRECT_COST">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_INDIRECT_COS_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_INDIRECT_COST_VALUE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_INDIRECT_COST_VALUE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -17,17 +17,17 @@
       <column name="CALCULATE" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="COST_UOM" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
       <column name="CALCULATED" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAINDIRECT_COST_VALUE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAINDIRECT_COST_VALUE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAINDIRECT_COST_VALUE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_INDIRECT_COST" name="MAINDIRECT_COST_MA_IC_VALUE">
         <reference local="MA_INDIRECT_COST_ID" foreign="MA_INDIRECT_COST_ID"/>
       </foreign-key>
+      <check name="MAINDCOVAL_CALCULATE_CHECK"><![CDATA[CALCULATE IN ('Y', 'N')]]></check>
       <check name="MAINDCOVAL_CALCULATED_CHECK"><![CDATA[CALCULATED IN ('Y', 'N')]]></check>
-      <check name="MAINDCOVAL_CALCULATE_CHECK"><![CDATA[CALCULATE IN ('Y', 'N')]]></check>
       <check name="MAINDCOVAL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_MACHINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MACHINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,12 +16,12 @@
       <column name="MA_COSTCENTER_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="COST" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="MA_MACHINE_TYPE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMACHINE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMACHINE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMACHINE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_COSTCENTER" name="MA_COSTCENTER_MAMACHINE">
         <reference local="MA_COSTCENTER_ID" foreign="MA_COSTCENTER_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_MACHINESTATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MACHINESTATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,18 +11,18 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_MACHINE_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_WORKSTATION_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMACHINESTATION">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMACHINESTATION">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMACHINESTATION">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="MA_WORKSTATION" name="MA_WORKSTATION_MAMACHINSTAT">
+        <reference local="MA_WORKSTATION_ID" foreign="MA_WORKSTATION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_MACHINE" name="MAMACHINE_MAMACHINESTATION">
         <reference local="MA_MACHINE_ID" foreign="MA_MACHINE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_WORKSTATION" name="MA_WORKSTATION_MAMACHINSTAT">
-        <reference local="MA_WORKSTATION_ID" foreign="MA_WORKSTATION_ID"/>
-      </foreign-key>
       <check name="MA_MACHINESTATI_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_MACHINE_TYPE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MACHINE_TYPE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,12 +11,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMACHINETYPE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMACHINETYPE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMACHINETYPE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_MACHINE_TYPE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_MAINTENANCE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MAINTENANCE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -17,14 +17,11 @@
       <column name="MA_MACHINE_TYPE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_MACHINE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="EXPLODE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMAINTENANCE">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINTENANCE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_MAINT_OPERATION" name="MAMAINTOPERATION_MAMAINTENANCE">
-        <reference local="MA_MAINT_OPERATION_ID" foreign="MA_MAINT_OPERATION_ID"/>
+      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMAINTENANCE">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_MACHINE" name="MA_MACHINE_MAMAINTENANCE">
         <reference local="MA_MACHINE_ID" foreign="MA_MACHINE_ID"/>
@@ -32,6 +29,9 @@
       <foreign-key foreignTable="MA_MACHINE_TYPE" name="MA_MACHINE_TYPE_MAMAINTENANCE">
         <reference local="MA_MACHINE_TYPE_ID" foreign="MA_MACHINE_TYPE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="MA_MAINT_OPERATION" name="MAMAINTOPERATION_MAMAINTENANCE">
+        <reference local="MA_MAINT_OPERATION_ID" foreign="MA_MAINT_OPERATION_ID"/>
+      </foreign-key>
       <check name="MA_MAINTENANCE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_MAINT_OPERATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MAINT_OPERATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,12 +11,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_OPERATION">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMAINT_OPERATION">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_OPERATION">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_MAINT_OPERAT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_MAINT_PART.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MAINT_PART.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,12 +13,12 @@
       <column name="PARTDATE" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="SHIFT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false"/>
       <column name="CREATEMAINT" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_PART">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMAINT_PART">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_PART">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_MAINT_PART_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_MAINT_PERIODICITY.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MAINT_PERIODICITY.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,12 +16,12 @@
       <column name="SHIFT" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="INITDATE" primaryKey="false" required="false" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="EXCLUDEWEEKEND" primaryKey="false" required="false" type="CHAR" size="1" default="Y" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_PERIODICITY">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMAINT_PERIODICITY">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_PERIODICITY">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_MAINTENANCE" name="MAMAINTENANCE_MAINTPERIODICITY">
         <reference local="MA_MAINTENANCE_ID" foreign="MA_MAINTENANCE_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_MAINT_SCHEDULED.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MAINT_SCHEDULED.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -23,11 +23,14 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="MA_MAINT_OPERATION_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="M_INTERNAL_CONSUMPTION_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_SCHEDULED">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMAINT_SCHEDULED">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_SCHEDULED">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="M_INTERNAL_CONSUMPTION" name="M_INTCONSUMP_MAINT_SCHEDULED">
+        <reference local="M_INTERNAL_CONSUMPTION_ID" foreign="M_INTERNAL_CONSUMPTION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_MACHINE_TYPE" name="MACHINETYPE_MAMAINT_SCHEDULED">
         <reference local="MA_MACHINE_TYPE_ID" foreign="MA_MACHINE_TYPE_ID"/>
@@ -44,9 +47,6 @@
       <foreign-key foreignTable="MA_MAINT_PART" name="MAMAINTPART_MAMAINT_SCHEDULED">
         <reference local="MA_MAINT_PART_ID" foreign="MA_MAINT_PART_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_INTERNAL_CONSUMPTION" name="M_INTCONSUMP_MAINT_SCHEDULED">
-        <reference local="M_INTERNAL_CONSUMPTION_ID" foreign="M_INTERNAL_CONSUMPTION_ID"/>
-      </foreign-key>
       <check name="MA_MAINT_SCHEDU_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_MAINT_WORKER.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MAINT_WORKER.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,12 +11,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_MAINT_PART_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="C_BPARTNER_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_WORKER">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMAINT_WORKER">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMAINT_WORKER">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_MAMAINT_WORKER">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_MEASURE_GROUP.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MEASURE_GROUP.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,12 +14,12 @@
       <column name="PRODUCT" primaryKey="false" required="false" type="NVARCHAR" size="40" autoIncrement="false"/>
       <column name="SEQNO" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="HASSECPRODUCT" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMEASURE_GROUP">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMEASUREGROUP">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMEASURE_GROUP">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_CCP_GROUP" name="MA_CCP_GROUP_MAMEASURE_GROUP">
         <reference local="MA_CCP_GROUP_ID" foreign="MA_CCP_GROUP_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_MEASURE_SHIFT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MEASURE_SHIFT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -18,15 +18,15 @@
       <column name="AD_USER_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="EDIT" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="PROCESSED" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMEASURESHIFT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMEASURE_SHIFT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_USER" name="AD_USER_MAMEASURESHIFT">
         <reference local="AD_USER_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMEASURESHIFT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
       <check name="MA_MEASURE_SHIFT_SHIFT_CHECK"><![CDATA[SHIFT IN ('M', 'T')]]></check>
       <check name="MEASURESHIFT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/MA_MEASURE_TIME.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MEASURE_TIME.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,12 +13,12 @@
       <column name="MEASUREHOUR" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="EXPLODE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="PROCESSED" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMEASURETIME">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMEASURETIME">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMEASURETIME">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_MEASURE_GROUP" name="MA_MEASURE_GROUP_MAMEASURETIME">
         <reference local="MA_MEASURE_GROUP_ID" foreign="MA_MEASURE_GROUP_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_MEASURE_VALUES.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_MEASURE_VALUES.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,12 +16,12 @@
       <column name="V_NUMBER" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="V_CHAR" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="SEQNO" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMEASUREVALUES">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAMEASUREVALUES">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAMEASUREVALUES">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_CCP" name="MA_CCP_MAMEASUREVALUES">
         <reference local="MA_CCP_ID" foreign="MA_CCP_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_PC_CASE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_PC_CASE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -22,12 +22,12 @@
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPCCASE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="MA_PERIODIC_CONTROL" name="MA_PERIODIC_CONTROL_MAPCCASE">
+        <reference local="MA_PERIODIC_CONTROL_ID" foreign="MA_PERIODIC_CONTROL_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRIBUTESETINSTANCE_MAPCCASE">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_PERIODIC_CONTROL" name="MA_PERIODIC_CONTROL_MAPCCASE">
-        <reference local="MA_PERIODIC_CONTROL_ID" foreign="MA_PERIODIC_CONTROL_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MAPCCASE">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_PC_TEST.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_PC_TEST.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,12 +13,12 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="DAYS" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"/>
       <column name="MA_PERIODIC_CONTROL_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPC_TEST">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAPC_TEST">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPC_TEST">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_PERIODIC_CONTROL" name="MA_PERIODIC_CONTROL_MAPCTEST">
         <reference local="MA_PERIODIC_CONTROL_ID" foreign="MA_PERIODIC_CONTROL_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_PERIODIC_CONTROL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_PERIODIC_CONTROL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,12 +11,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPERIODIC_CONTROL">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAPERIODIC_CONTROL">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPERIODIC_CONTROL">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_PERIODIC_CON_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_PROCESS.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_PROCESS.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -16,12 +16,12 @@
       <column name="MA_CC_IDPREP" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_CC_IDWORK" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_COSTCENTER_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPROCESS">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAPROCESS">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPROCESS">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_COSTCENTER" name="MA_COSTCENTER_MAPROCESS">
         <reference local="MA_COSTCENTER_ID" foreign="MA_COSTCENTER_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_PROCESSPLAN.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_PROCESSPLAN.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -17,14 +17,14 @@
       <column name="SECONDARYUNIT" primaryKey="false" required="false" type="NVARCHAR" size="40" autoIncrement="false"/>
       <column name="CONVERSIONRATE" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="COPYVERSION" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPROCESSPLAN">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAPROCESSPLAN">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPROCESSPLAN">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
+      <check name="MA_PROCESSPLAN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MAPROCPLAN_CALCULATED_CHECK"><![CDATA[CALCULATED IN ('Y', 'N')]]></check>
       <check name="MAPROCPLAN_EXPLPHASES_CHECK"><![CDATA[EXPLODEPHASES IN ('Y', 'N')]]></check>
-      <check name="MA_PROCESSPLAN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_PROCESSPLAN_VERSION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_PROCESSPLAN_VERSION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,12 +13,12 @@
       <column name="DOCUMENTNO" primaryKey="false" required="true" type="NVARCHAR" size="30" autoIncrement="false"/>
       <column name="DATEFROM" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="DATETO" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPROCESSPLANVERSION">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAPROCESSPLANVERSION">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPROCESSPLANVERSION">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_PROCESSPLAN" name="MA_PROCPLAN_MAPROCPLANVERSION">
         <reference local="MA_PROCESSPLAN_ID" foreign="MA_PROCESSPLAN_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_PRODUCTTYPE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_PRODUCTTYPE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,12 +13,12 @@
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="RMINPUT" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="RMOUTPUT" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPRODUCTTYPE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAPRODUCTTYPE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAPRODUCTTYPE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_PRODUCTTYPE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MA_PRODUCTTYPE_RMINPUT_CHECK"><![CDATA[RMINPUT IN ('Y', 'N')]]></check>
       <check name="MA_PRODUCTTYPE_RMOUTPUT_CHECK"><![CDATA[RMOUTPUT IN ('Y', 'N')]]></check>
--- a/database/model/tables/MA_SECTION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_SECTION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,12 +11,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASECTION">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MASECTION">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASECTION">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_SECTION_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_SEQUENCE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_SEQUENCE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -25,18 +25,18 @@
       <column name="OUTSOURCED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="OUTSOURCINGCOST" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="ISDEFAULT" primaryKey="false" required="true" type="CHAR" size="1" default="Y" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MASEQUENCE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="MA_PROCESS" name="MAPROCESS_MASEQUENCE">
+        <reference local="MA_PROCESS_ID" foreign="MA_PROCESS_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_PROCESSPLAN_VERSION" name="MAPROCESSPLANVERSION_MASEQ">
         <reference local="MA_PROCESSPLAN_VERSION_ID" foreign="MA_PROCESSPLAN_VERSION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_PROCESS" name="MAPROCESS_MASEQUENCE">
-        <reference local="MA_PROCESS_ID" foreign="MA_PROCESS_ID"/>
-      </foreign-key>
       <check name="MA_SEQUENCE_CALCULATED_CHECK"><![CDATA[CALCULATED IN ('Y', 'N')]]></check>
       <check name="MA_SEQUENCE_GROUPUSE_CHECK"><![CDATA[GROUPUSE IN ('Y', 'N')]]></check>
       <check name="MA_SEQUENCE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
--- a/database/model/tables/MA_SEQUENCEPRODUCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_SEQUENCEPRODUCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -23,24 +23,24 @@
       <column name="CONSUMERM" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="DECREASEIND" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="COST" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCEPRODUCT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MASEQUENCEPRODUCT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCEPRODUCT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_UOM" name="CUOMID_MASEQUENCEPRODUCT">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MASEQUENCEPRODUCT">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="MA_SEQUENCE" name="MASEQUENCE_MASEQUENCEPRODUCT">
         <reference local="MA_SEQUENCE_ID" foreign="MA_SEQUENCE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MASEQPRODUCT">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MASEQUENCEPRODUCT">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <check name="MA_SEQUENCEPROD_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_SEQUENCEPRODUCT_COST.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_SEQUENCEPRODUCT_COST.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -21,18 +21,18 @@
       <column name="COSTCENTERCOST" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="MA_CALCSTD_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="RAWMATERIALCOST" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCEPRODUCTCOST">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MASEQUENCEPRODUCTCOST">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCEPRODUCTCOST">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="MA_CALCSTD" name="MA_CALCSTD_MASEQPRODCOST">
+        <reference local="MA_CALCSTD_ID" foreign="MA_CALCSTD_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_SEQUENCEPRODUCT" name="MASEQUENCEPRODUCT_MASEQUENCEPR">
         <reference local="MA_SEQUENCEPRODUCT_ID" foreign="MA_SEQUENCEPRODUCT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_CALCSTD" name="MA_CALCSTD_MASEQPRODCOST">
-        <reference local="MA_CALCSTD_ID" foreign="MA_CALCSTD_ID"/>
-      </foreign-key>
       <check name="MASEQPRODCT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MASEQPRODCT_PRO_TIONTYPE_CHECK"><![CDATA[PRODUCTIONTYPE IN ('+', '-')]]></check>
     </table>
--- a/database/model/tables/MA_TOOLSET.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_TOOLSET.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="M_LOCATOR_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="NUMBERUSES" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="DISCARDED" primaryKey="false" required="true" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSET">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MATOOLSET">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSET">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="M_LOCATOR" name="M_LOCATORMATOOLSET">
+        <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_TOOLSET_TYPE" name="MA_TOOLSET_TYPEMATOOLSET">
         <reference local="MA_TOOLSET_TYPE_ID" foreign="MA_TOOLSET_TYPE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_LOCATOR" name="M_LOCATORMATOOLSET">
-        <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
-      </foreign-key>
       <check name="MA_TOOLSET_DISCARDED_CHECK"><![CDATA[DISCARDED IN ('Y', 'N')]]></check>
       <check name="MA_TOOLSET_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/MA_TOOLSETPROCESS.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_TOOLSETPROCESS.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,12 +12,12 @@
       <column name="MA_TOOLSET_TYPE_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="MA_PROCESS_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="USECOEF" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSETPROCESS">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MATOOLSETPROCESS">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSETPROCESS">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_PROCESS" name="MA_PROCESSMATOOLSETPROCESS">
         <reference local="MA_PROCESS_ID" foreign="MA_PROCESS_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_TOOLSETUSED.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_TOOLSETUSED.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,18 +12,18 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="USED" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false"/>
       <column name="MA_TOOLSETUSED_ID" primaryKey="true" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSETUSED">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MATOOLSETUSED">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSETUSED">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="M_PRODUCTIONPLAN" name="M_PRODPLAN_MATOOLSETUSED">
+        <reference local="M_PRODUCTIONPLAN_ID" foreign="M_PRODUCTIONPLAN_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_TOOLSET" name="MA_TOOLSET_MATOOLSETUSED">
         <reference local="MA_TOOLSET_ID" foreign="MA_TOOLSET_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCTIONPLAN" name="M_PRODPLAN_MATOOLSETUSED">
-        <reference local="M_PRODUCTIONPLAN_ID" foreign="M_PRODUCTIONPLAN_ID"/>
-      </foreign-key>
       <check name="MA_TOOLSETUSED_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_TOOLSET_TYPE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_TOOLSET_TYPE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,12 +12,12 @@
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="USECYCLE" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSETTYPE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MATOOLSETTYPE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MATOOLSETTYPE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="MA_TOOLSET_TYPE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_WEEMPLOYEE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_WEEMPLOYEE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,12 +11,12 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="M_PRODUCTION_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="C_BPARTNER_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWEEMPLOYEE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWEEMPLOYEE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWEEMPLOYEE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="C_BPARTNER_MAWEEMPLOYEE">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_WEINCIDENCE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_WEINCIDENCE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -14,18 +14,18 @@
       <column name="STARTTIME" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="ENDTIME" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWEINCIDENCE">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWEINCIDENCE">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWEINCIDENCE">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      <foreign-key foreignTable="M_PRODUCTION" name="M_PRODUCTION_MAWEINCIDENCE">
+        <reference local="M_PRODUCTION_ID" foreign="M_PRODUCTION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_INCIDENCE" name="MA_INCIDENCE_MAWEINCIDENCE">
         <reference local="MA_INCIDENCE_ID" foreign="MA_INCIDENCE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCTION" name="M_PRODUCTION_MAWEINCIDENCE">
-        <reference local="M_PRODUCTION_ID" foreign="M_PRODUCTION_ID"/>
-      </foreign-key>
       <check name="MA_WEINCIDENCE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_WETECHNICALSUPPORT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_WETECHNICALSUPPORT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -13,14 +13,14 @@
       <column name="M_PRODUCTION_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="A_ASSET_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWETECHNICALSUPPORT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      <foreign-key foreignTable="A_ASSET" name="A_ASSET_MAWETECHNICALSUPPORT">
+        <reference local="A_ASSET_ID" foreign="A_ASSET_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWETECHNICALSUPPORT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="A_ASSET" name="A_ASSET_MAWETECHNICALSUPPORT">
-        <reference local="A_ASSET_ID" foreign="A_ASSET_ID"/>
+      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWETECHNICALSUPPORT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCTION" name="M_PRODUCTION_MAWETS">
         <reference local="M_PRODUCTION_ID" foreign="M_PRODUCTION_ID"/>
--- a/database/model/tables/MA_WORKREQUIREMENT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_WORKREQUIREMENT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -24,18 +24,18 @@
       <column name="SECONDARYUNIT" primaryKey="false" required="false" type="NVARCHAR" size="40" autoIncrement="false"/>
       <column name="CONVERSIONRATE" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="WRTYPE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWORKREQUIREMENT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWORKREQUIREMENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWORKREQUIREMENT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_PROCESSPLAN" name="MA_PROCESSPLAN_MAWORKREQ">
         <reference local="MA_PROCESSPLAN_ID" foreign="MA_PROCESSPLAN_ID"/>
       </foreign-key>
+      <check name="MAWORKREQ_EXPLODEPHASES_CHECK"><![CDATA[EXPLODEPHASES IN ('Y', 'N')]]></check>
       <check name="MAWORKREQMENT_CLOSED_CHECK"><![CDATA[CLOSED IN ('Y', 'N')]]></check>
       <check name="MAWORKREQMENT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MAWORKREQMENT_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
-      <check name="MAWORKREQ_EXPLODEPHASES_CHECK"><![CDATA[EXPLODEPHASES IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MA_WORKSTATION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_WORKSTATION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -12,12 +12,12 @@
       <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="MA_SECTION_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="VALUE" primaryKey="false" required="true" type="NVARCHAR" size="40" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWORKSTATION">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWORKSTATION">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWORKSTATION">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MA_SECTION" name="MA_GFH_MASECTION">
         <reference local="MA_SECTION_ID" foreign="MA_SECTION_ID"/>
       </foreign-key>
--- a/database/model/tables/MA_WRPHASE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_WRPHASE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -23,14 +23,11 @@
       <column name="NAME" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
       <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="255" autoIncrement="false"/>
       <column name="OUTSOURCED" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
-      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWRPHASE">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWRPHASE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_PROCESS" name="MAPROCESS_MAWRPHASE">
-        <reference local="MA_PROCESS_ID" foreign="MA_PROCESS_ID"/>
+      <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWRPHASE">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_SEQUENCE" name="MA_SEQUENCE_MAWRPHASE">
         <reference local="MA_SEQUENCE_ID" foreign="MA_SEQUENCE_ID"/>
@@ -38,6 +35,9 @@
       <foreign-key foreignTable="MA_WORKREQUIREMENT" name="MA_WORKREQUIREMENT_MAWRPHASE">
         <reference local="MA_WORKREQUIREMENT_ID" foreign="MA_WORKREQUIREMENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="MA_PROCESS" name="MAPROCESS_MAWRPHASE">
+        <reference local="MA_PROCESS_ID" foreign="MA_PROCESS_ID"/>
+      </foreign-key>
       <check name="MA_WRPHASE_CLOSED_CHECK"><![CDATA[CLOSED IN ('Y', 'N')]]></check>
       <check name="MA_WRPHASE_GROUPUSE_CHECK"><![CDATA[GROUPUSE IN ('Y', 'N')]]></check>
       <check name="MA_WRPHASE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
--- a/database/model/tables/MA_WRPHASEPRODUCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MA_WRPHASEPRODUCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -20,24 +20,24 @@
       <column name="COMPONENTCOST" primaryKey="false" required="false" type="DECIMAL" default="1" autoIncrement="false"/>
       <column name="CONSUMERM" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
       <column name="DECREASEIND" primaryKey="false" required="false" type="CHAR" size="1" default="N" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWRPHASEPRODUCT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MAWRPHASEPRODUCT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWRPHASEPRODUCT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_UOM" name="CUOMID_MAWRPHASEPRODUCT">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MAWRPHASEPRODUCT">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="MA_WRPHASE" name="MAWRPHASE_MAWRPHASEPRODUCT">
         <reference local="MA_WRPHASE_ID" foreign="MA_WRPHASE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MAWRPHASEPRODUCT">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MAWRPHASEPRODUCT">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <check name="MAWRPHASEPROD_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MAWRPHASPRODT_PRODTYPE_CHECK"><![CDATA[PRODUCTIONTYPE IN ('+', '-')]]></check>
     </table>
--- a/database/model/tables/MRP_RUN_PRODUCTION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MRP_RUN_PRODUCTION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -29,25 +29,25 @@
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MRP_RUN_PRODUCTION">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BP_GROUP" name="C_BP_GROUP_MRP_RUN_PRODUCTION">
+        <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="C_BPARTNER_MRP_RUN_PRODUCTION">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BP_GROUP" name="C_BP_GROUP_MRP_RUN_PRODUCTION">
-        <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PRODUCTION">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="M_PRODUCTCATEGORY_RPROD">
+        <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MRP_PLANNER" name="MRP_PLANNER_RUN_PRODUCTION">
         <reference local="MRP_PLANNER_ID" foreign="MRP_PLANNER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="M_PRODUCTCATEGORY_RPROD">
-        <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PRODUCTION">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
+      <check name="MRPRUNPROD_RECA_ATESTOCK_CHECK"><![CDATA[RECALCULATESTOCK IN ('Y', 'N')]]></check>
       <check name="MRPRUNPRODUCTIO_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MRPRUNPRODUCTIO_LAUNCHMR_CHECK"><![CDATA[LAUNCHMR IN ('Y', 'N')]]></check>
       <check name="MRPRUNPRODUCTIO_LAUNCHWR_CHECK"><![CDATA[LAUNCHWR IN ('Y', 'N')]]></check>
       <check name="MRPRUNPRODUCTIO_SIMULATE_CHECK"><![CDATA[SIMULATE IN ('Y', 'N')]]></check>
-      <check name="MRPRUNPROD_RECA_ATESTOCK_CHECK"><![CDATA[RECALCULATESTOCK IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/MRP_RUN_PRODUCTIONLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MRP_RUN_PRODUCTIONLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -36,24 +36,24 @@
       <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_PRODUCTION">
         <reference local="C_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_WORKREQUIREMENT" name="MAWORKREQUIREMENT_MRPRUNPRODUC">
-        <reference local="MA_WORKREQUIREMENT_ID" foreign="MA_WORKREQUIREMENT_ID"/>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PRODUCTIONLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="M_REQUISITIONLINE" name="M_REQUISITIONLINE_PRODUCTION">
+        <reference local="M_REQUISITIONLINE_ID" foreign="M_REQUISITIONLINE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_PROCESSPLAN" name="MA_PROCESSPLAN_PRODUCTIONLINE">
         <reference local="MA_PROCESSPLAN_ID" foreign="MA_PROCESSPLAN_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="MA_WORKREQUIREMENT" name="MAWORKREQUIREMENT_MRPRUNPRODUC">
+        <reference local="MA_WORKREQUIREMENT_ID" foreign="MA_WORKREQUIREMENT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="MRP_RUN_PRODUCTION" name="MRP_PLANNER_RUN_PRODUCTIONLINE">
         <reference local="MRP_RUN_PRODUCTION_ID" foreign="MRP_RUN_PRODUCTION_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MRP_SALESFORECASTLINE" name="MRP_SALESFORECASTLINE_PROD">
         <reference local="MRP_SALESFORECASTLINE_ID" foreign="MRP_SALESFORECASTLINE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PRODUCTIONLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="M_REQUISITIONLINE" name="M_REQUISITIONLINE_PRODUCTION">
-        <reference local="M_REQUISITIONLINE_ID" foreign="M_REQUISITIONLINE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="MRP_RUN_PRODUCTIONLINE" name="PARENT_MRP_RUN_PRODUCTIONLINE">
         <reference local="PARENT_ID" foreign="MRP_RUN_PRODUCTIONLINE_ID"/>
       </foreign-key>
--- a/database/model/tables/MRP_RUN_PURCHASE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MRP_RUN_PURCHASE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -29,20 +29,20 @@
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MRP_RUN_PURCHASE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BP_GROUP" name="C_BP_GROUP_MRP_RUN_PURCHASE">
+        <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="C_BPARTNER_MRP_RUN_PURCHASE">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BP_GROUP" name="C_BP_GROUP_MRP_RUN_PURCHASE">
-        <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="MRP_PLANNER" name="MRP_PLANNER_RUN_PURCHASE">
-        <reference local="MRP_PLANNER_ID" foreign="MRP_PLANNER_ID"/>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PURCHASE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="M_PRODUCTCATEGORY_PURCHASE">
         <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PURCHASE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      <foreign-key foreignTable="MRP_PLANNER" name="MRP_PLANNER_RUN_PURCHASE">
+        <reference local="MRP_PLANNER_ID" foreign="MRP_PLANNER_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="VENDOR_MRP_RUN_PURCHASE">
         <reference local="VENDOR_ID" foreign="C_BPARTNER_ID"/>
--- a/database/model/tables/MRP_RUN_PURCHASELINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MRP_RUN_PURCHASELINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -30,11 +30,17 @@
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MRP_RUN_PURCHASELINE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_PURCHASE">
+        <reference local="C_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_MRPRUNPURCHLN">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_PURCHASE">
-        <reference local="C_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PURCHASELINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="M_REQUISITIONLINE" name="M_REQUISITIONLINE_RUN_PURCHASE">
+        <reference local="M_REQUISITIONLINE_ID" foreign="M_REQUISITIONLINE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="MA_WORKREQUIREMENT" name="MAWORKREQUIREMENT_MRPRUNPURCHA">
         <reference local="MA_WORKREQUIREMENT_ID" foreign="MA_WORKREQUIREMENT_ID"/>
@@ -45,12 +51,6 @@
       <foreign-key foreignTable="MRP_SALESFORECASTLINE" name="MRP_SALESFORECASTLINE_PURCHASE">
         <reference local="MRP_SALESFORECASTLINE_ID" foreign="MRP_SALESFORECASTLINE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_RUN_PURCHASELINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="M_REQUISITIONLINE" name="M_REQUISITIONLINE_RUN_PURCHASE">
-        <reference local="M_REQUISITIONLINE_ID" foreign="M_REQUISITIONLINE_ID"/>
-      </foreign-key>
       <check name="MRPRUNPURLN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MRPRUNPURLN_ISFIXED_CHECK"><![CDATA[ISFIXED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/MRP_SALESFORECASTLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/MRP_SALESFORECASTLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -19,12 +19,12 @@
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MRPSALESFORECASTLINE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MRPSALESFORECASTLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="MRP_SALESFORECAST" name="MRPSALESFORECAST_MRPSALESFOREC">
         <reference local="MRP_SALESFORECAST_ID" foreign="MRP_SALESFORECAST_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_MRPSALESFORECASTLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <check name="MRPSALLN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/M_ATTRIBUTEINSTANCE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_ATTRIBUTEINSTANCE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -18,12 +18,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_MATTRIBUTEINSTANCE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_ATTRIBUTE" name="MATTRIBUTE_MATTRIBUTEINST">
+        <reference local="M_ATTRIBUTE_ID" foreign="M_ATTRIBUTE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTEVALUE" name="MATTRIBUTEVALUE_MATTRINST">
         <reference local="M_ATTRIBUTEVALUE_ID" foreign="M_ATTRIBUTEVALUE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_ATTRIBUTE" name="MATTRIBUTE_MATTRIBUTEINST">
-        <reference local="M_ATTRIBUTE_ID" foreign="M_ATTRIBUTE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRSETINST__MATTRINST" onDelete="cascade">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
--- a/database/model/tables/M_ATTRIBUTEUSE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_ATTRIBUTEUSE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -17,12 +17,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_MATTRIBUTEUSE">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_ATTRIBUTE" name="MATTRIBUTE_MATTRIBUTEUSE">
+        <reference local="M_ATTRIBUTE_ID" foreign="M_ATTRIBUTE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTESET" name="MATTRIBUTESET_MATTRIBUTEUSE">
         <reference local="M_ATTRIBUTESET_ID" foreign="M_ATTRIBUTESET_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_ATTRIBUTE" name="MATTRIBUTE_MATTRIBUTEUSE">
-        <reference local="M_ATTRIBUTE_ID" foreign="M_ATTRIBUTE_ID"/>
-      </foreign-key>
       <check name="M_ATTRIBUTEUSE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/M_COSTING.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_COSTING.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -31,14 +31,14 @@
       <foreign-key foreignTable="C_INVOICELINE" name="CINVOICELINE_MCOSTING">
         <reference local="C_INVOICELINE_ID" foreign="C_INVOICELINE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCTIONLINE" name="M_PRODUCTIONLINE_MCOSTING">
+        <reference local="M_PRODUCTIONLINE_ID" foreign="M_PRODUCTIONLINE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="MCOSTING_FK_MPRODUCT">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_INOUTLINE" name="MINOUTLINE_MCOSTING">
         <reference local="M_INOUTLINE_ID" foreign="M_INOUTLINE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCTIONLINE" name="M_PRODUCTIONLINE_MCOSTING">
-        <reference local="M_PRODUCTIONLINE_ID" foreign="M_PRODUCTIONLINE_ID"/>
-      </foreign-key>
     </table>
   </database>
--- a/database/model/tables/M_FREIGHT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_FREIGHT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -30,21 +30,21 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_MFREIGHT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_MFREIGHT">
+        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRYTO_MFREIGHT">
         <reference local="TO_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_COUNTRY" name="CCOUNTRY_MFREIGHT">
-        <reference local="C_COUNTRY_ID" foreign="C_COUNTRY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_MFREIGHT">
         <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_REGION" name="CREGION_MFREIGHT">
+        <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_REGION" name="CREGIONTO_MFREIGHT">
         <reference local="TO_REGION_ID" foreign="C_REGION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_REGION" name="CREGION_MFREIGHT">
-        <reference local="C_REGION_ID" foreign="C_REGION_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_FREIGHTCATEGORY" name="MFREIGHTCATEGORY_MFREIGHT">
         <reference local="M_FREIGHTCATEGORY_ID" foreign="M_FREIGHTCATEGORY_ID"/>
       </foreign-key>
--- a/database/model/tables/M_INOUT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_INOUT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -98,15 +98,15 @@
       <foreign-key foreignTable="C_PROJECT" name="CPROJECT_MINOUT">
         <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_FREIGHTCATEGORY" name="M_FREIGHTCATEGORY_M_INOUT">
+        <reference local="M_FREIGHTCATEGORY_ID" foreign="M_FREIGHTCATEGORY_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_SHIPPER" name="MSHIPPER_MINOUT">
         <reference local="M_SHIPPER_ID" foreign="M_SHIPPER_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_WAREHOUSE" name="MWAREHOUSE_MINOUT">
         <reference local="M_WAREHOUSE_ID" foreign="M_WAREHOUSE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_FREIGHTCATEGORY" name="M_FREIGHTCATEGORY_M_INOUT">
-        <reference local="M_FREIGHTCATEGORY_ID" foreign="M_FREIGHTCATEGORY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER_LOCATION" name="VBPLOCATION_MINOUT">
         <reference local="C_BPARTNER_LOCATION_ID" foreign="C_BPARTNER_LOCATION_ID"/>
       </foreign-key>
@@ -123,7 +123,6 @@
         <index-column name="UPDATED"/>
       </index>
       <check name="ISLOGISTIC_MINOUT"><![CDATA[ISLOGISTIC IN ('N', 'Y')]]></check>
-      <check name="MINOUT_UPDATELINES_YN"><![CDATA[UPDATELINES IN ('Y', 'N')]]></check>
       <check name="M_INOUT_CREATEFROM_CHECK"><![CDATA[CREATEFROM IN ('Y', 'N')]]></check>
       <check name="M_INOUT_GENERATELINES_CHECK"><![CDATA[GENERATELINES IN ('N', 'Y')]]></check>
       <check name="M_INOUT_GENERATETO_CHECK"><![CDATA[GENERATETO IN ('Y', 'N')]]></check>
@@ -131,5 +130,6 @@
       <check name="M_INOUT_ISPRINTED_CHECK"><![CDATA[ISPRINTED IN ('Y', 'N')]]></check>
       <check name="M_INOUT_ISSOTRX_CHECK"><![CDATA[ISSOTRX IN ('Y', 'N')]]></check>
       <check name="M_INOUT_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
+      <check name="MINOUT_UPDATELINES_YN"><![CDATA[UPDATELINES IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/M_INOUTLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_INOUTLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -40,21 +40,21 @@
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRSETINST_MINOUTLINE">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_INOUT" name="MINOUT_MINOUTLINE" onDelete="cascade">
+        <reference local="M_INOUT_ID" foreign="M_INOUT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_INOUTLINE_TYPE" name="MINOUTLINETYPE_MINOUTLINE">
         <reference local="M_INOUTLINE_TYPE_ID" foreign="M_INOUTLINE_TYPE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_INOUT" name="MINOUT_MINOUTLINE" onDelete="cascade">
-        <reference local="M_INOUT_ID" foreign="M_INOUT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MINOUTLINE">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINOUTLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MINOUTLINE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINOUTLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <index name="M_INOUTLINE_INOUT" unique="false">
         <index-column name="M_INOUT_ID"/>
       </index>
--- a/database/model/tables/M_INTERNAL_CONSUMPTION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_INTERNAL_CONSUMPTION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -21,7 +21,7 @@
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MINTERNAL_CONSUMPTION">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <check name="M_INTERNAL_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
       <check name="MINTERNCONSUMPT_ISACTIV_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
-      <check name="M_INTERNAL_PROCESSED_CHECK"><![CDATA[PROCESSED IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/M_INTERNAL_CONSUMPTIONLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_INTERNAL_CONSUMPTIONLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -37,12 +37,12 @@
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MINTERNALCONSUMPLINE">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINTCONSUMPTIONLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MINTCONSUMPLINE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINTCONSUMPTIONLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <index name="MINTERNAL_CONSUMPTIONLINE_INDX" unique="false">
         <index-column name="M_INTERNAL_CONSUMPTION_ID"/>
       </index>
--- a/database/model/tables/M_INVENTORYLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_INVENTORYLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -39,12 +39,12 @@
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MINVENTORYLINE">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINVENTORYLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MINVENTORYLINE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINVENTORYLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <index name="M_INVENTORYLINE_INVENTORY" unique="false">
         <index-column name="M_INVENTORY_ID"/>
       </index>
--- a/database/model/tables/M_LOCATOR.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_LOCATOR.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -19,9 +19,6 @@
       <column name="SIZEMULTIPLIER" primaryKey="false" required="false" type="DECIMAL" default="1" autoIncrement="false"/>
       <column name="INVOICINGTYPE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="M_LOCATOR_TYPE_ID" primaryKey="false" required="false" type="DECIMAL" size="10,0" autoIncrement="false"/>
-      <foreign-key foreignTable="M_LOCATOR_TYPE" name="MLOCATORTYPE_MLOCATOR">
-        <reference local="M_LOCATOR_TYPE_ID" foreign="M_LOCATOR_TYPE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_WAREHOUSE" name="M_WAREHOUSE_LOCATOR" onDelete="cascade">
         <reference local="M_WAREHOUSE_ID" foreign="M_WAREHOUSE_ID"/>
       </foreign-key>
@@ -31,6 +28,9 @@
       <foreign-key foreignTable="AD_ORG" name="M_WH_LOCATOR_ORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_LOCATOR_TYPE" name="MLOCATORTYPE_MLOCATOR">
+        <reference local="M_LOCATOR_TYPE_ID" foreign="M_LOCATOR_TYPE_ID"/>
+      </foreign-key>
       <unique name="M_LOCATION_WHERE">
         <unique-column name="M_WAREHOUSE_ID"/>
         <unique-column name="X"/>
--- a/database/model/tables/M_MOVEMENTLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_MOVEMENTLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -32,25 +32,25 @@
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRSETINST_MMOVEMENTLINE">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MOVEMENTLINE">
+        <reference local="M_LOCATORTO_ID" foreign="M_LOCATOR_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATORTO_MMOVEMENTLINE">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MOVEMENTLINE">
-        <reference local="M_LOCATORTO_ID" foreign="M_LOCATOR_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_MOVEMENT" name="MMOVEMENT_MMOVEMENTLINE">
         <reference local="M_MOVEMENT_ID" foreign="M_MOVEMENT_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MMOVEMENTLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MMOVEMENTLINE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MMOVEMENTLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <index name="M_MOVEMENTLINE_MOVEMENT" unique="false">
         <index-column name="M_MOVEMENT_ID"/>
       </index>
+      <check name="M_MOVEMENTLINE_CHECK1"><![CDATA[((QUANTITYORDER IS NULL) AND (M_PRODUCT_UOM_ID IS NULL)) OR ((QUANTITYORDER IS NOT NULL) AND (M_PRODUCT_UOM_ID IS NOT NULL))]]></check>
       <check name="MMOVEMENTLINE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
-      <check name="M_MOVEMENTLINE_CHECK1"><![CDATA[((QUANTITYORDER IS NULL) AND (M_PRODUCT_UOM_ID IS NULL)) OR ((QUANTITYORDER IS NOT NULL) AND (M_PRODUCT_UOM_ID IS NOT NULL))]]></check>
     </table>
   </database>
--- a/database/model/tables/M_OFFER_PRICELIST.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_OFFER_PRICELIST.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,6 +11,9 @@
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="M_OFFER_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="M_PRICELIST_ID" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
+      <foreign-key foreignTable="M_OFFER" name="MOFFER_MOFFERPRICELIST">
+        <reference local="M_OFFER_ID" foreign="M_OFFER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="MOFFERPRICELIST_ADCLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -20,8 +23,5 @@
       <foreign-key foreignTable="M_PRICELIST" name="MOFFERPRICELIST_MPRICELIST">
         <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_OFFER" name="MOFFER_MOFFERPRICELIST">
-        <reference local="M_OFFER_ID" foreign="M_OFFER_ID"/>
-      </foreign-key>
     </table>
   </database>
--- a/database/model/tables/M_PRICELIST.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_PRICELIST.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -33,9 +33,9 @@
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
       </unique>
+      <check name="M_PRICELIST_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MPRICELISTISSOPRLIST_CHECK"><![CDATA[ISSOPRICELIST IN ('Y', 'N')]]></check>
       <check name="MPRICELISTISTAXINCL_CHECK"><![CDATA[ISTAXINCLUDED IN ('Y', 'N')]]></check>
       <check name="MPRLIST_ENFORCEPRLIM_CHECK"><![CDATA[ENFORCEPRICELIMIT IN ('Y', 'N')]]></check>
-      <check name="M_PRICELIST_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/M_PRICELIST_VERSION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_PRICELIST_VERSION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -26,12 +26,12 @@
       <foreign-key foreignTable="M_DISCOUNTSCHEMA" name="MDISCOUNTS_MPLVERSION">
         <reference local="M_DISCOUNTSCHEMA_ID" foreign="M_DISCOUNTSCHEMA_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_MPRICELISTVERSION" onDelete="cascade">
+        <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRICELIST_VERSION" name="MPRICELISTVERSION_MPRICELISTVE">
         <reference local="M_PRICELIST_VERSION_BASE_ID" foreign="M_PRICELIST_VERSION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRICELIST" name="MPRICELIST_MPRICELISTVERSION" onDelete="cascade">
-        <reference local="M_PRICELIST_ID" foreign="M_PRICELIST_ID"/>
-      </foreign-key>
       <check name="MPRICELISTVER_GENERATE_CHECK"><![CDATA[M_PRICELIST_VERSION_GENERATE IN ('Y', 'N')]]></check>
       <check name="MPRICELISTVER_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/M_PRODUCT.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_PRODUCT.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -76,15 +76,15 @@
       <column name="QTYSTD" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="QTYTYPE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
       <column name="STOCKMIN" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MPRODUCT">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="ADCLIENT_MPRODUCT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_IMAGE" name="ADIMAGE_MPRODUCT">
         <reference local="AD_IMAGE_ID" foreign="AD_IMAGE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_ORG_MPRODUCT">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="CBPARTNER_MPRODUCT">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
@@ -97,18 +97,18 @@
       <foreign-key foreignTable="C_UOM" name="CUOM_MPRODUCT">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="MA_PROCESSPLAN" name="MA_PROCESSPLAN_MPRODUCT">
+        <reference local="MA_PROCESSPLAN_ID" foreign="MA_PROCESSPLAN_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="MA_PRODUCTTYPE" name="MA_PRODUCTTYPE_MPRODUCT">
+        <reference local="MA_PRODUCTTYPE_ID" foreign="MA_PRODUCTTYPE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTESET" name="MATTRIBUTESET_MPRODUCT" onDelete="cascade">
         <reference local="M_ATTRIBUTESET_ID" foreign="M_ATTRIBUTESET_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRSETINST_MPRODUCT">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="MA_PROCESSPLAN" name="MA_PROCESSPLAN_MPRODUCT">
-        <reference local="MA_PROCESSPLAN_ID" foreign="MA_PROCESSPLAN_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="MA_PRODUCTTYPE" name="MA_PRODUCTTYPE_MPRODUCT">
-        <reference local="MA_PRODUCTTYPE_ID" foreign="MA_PRODUCTTYPE_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_FREIGHTCATEGORY" name="MFREIGHTCATEGORY_MPRODUCT">
         <reference local="M_FREIGHTCATEGORY_ID" foreign="M_FREIGHTCATEGORY_ID"/>
       </foreign-key>
--- a/database/model/tables/M_PRODUCTIONLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_PRODUCTIONLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -41,20 +41,20 @@
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MPRODUCTIONLINE">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MPRODUCTIONLINE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCTIONPLAN" name="MPRODUCTIONPLAN_LINE">
         <reference local="M_PRODUCTIONPLAN_ID" foreign="M_PRODUCTIONPLAN_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOMID_MPRODUCTIONLINE">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MPRODUCTIONLINE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <index name="M_PRODUCTIONLINE_PRODPLAN" unique="false">
         <index-column name="M_PRODUCTIONPLAN_ID"/>
       </index>
+      <check name="M_PRODUCTIONLINE_CHECK1"><![CDATA[((QUANTITYORDER IS NULL) AND (M_PRODUCT_UOM_ID IS NULL)) OR ((QUANTITYORDER IS NOT NULL) AND (M_PRODUCT_UOM_ID IS NOT NULL))]]></check>
       <check name="MPRODUCTLINE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="MPRODUCTLINE_PRINTLABEL_CHECK"><![CDATA[PRINTLABEL IN ('Y', 'N')]]></check>
-      <check name="M_PRODUCTIONLINE_CHECK1"><![CDATA[((QUANTITYORDER IS NULL) AND (M_PRODUCT_UOM_ID IS NULL)) OR ((QUANTITYORDER IS NOT NULL) AND (M_PRODUCT_UOM_ID IS NOT NULL))]]></check>
     </table>
   </database>
--- a/database/model/tables/M_PRODUCTIONPLAN.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_PRODUCTIONPLAN.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -43,12 +43,12 @@
       <foreign-key foreignTable="MA_WRPHASE" name="MPRODPLAN_MAPRODUCTOINRUN">
         <reference local="MA_WRPHASE_ID" foreign="MA_WRPHASE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MPRODUCTIONPLAN">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCTION" name="MPRODUCTION_PLAN">
         <reference local="M_PRODUCTION_ID" foreign="M_PRODUCTION_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MPRODUCTIONPLAN">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <index name="M_PRODUCTIONPLAN_PRODUCTION" unique="false">
         <index-column name="M_PRODUCTION_ID"/>
       </index>
--- a/database/model/tables/M_PRODUCT_PO.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_PRODUCT_PO.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -34,24 +34,24 @@
       <column name="CAPACITY" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="QTYSTD" primaryKey="false" required="false" type="DECIMAL" autoIncrement="false"/>
       <column name="QTYTYPE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false"/>
-      <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_MPRODUCTPO">
-        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="C_BUSPARTNER_M_PRODUCT_PO">
         <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_UOM" name="C_UOM_M_PRODUCT_PO">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_CURRENCY" name="CCURRENCY_MPRODUCTPO">
+        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_PRODUCTPO" onDelete="cascade">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_CLIENT" name="M_PRODUCTPO_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_ORG" name="M_PRODUCTPO_ORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="M_PRODUCT_PRODUCTPO" onDelete="cascade">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <unique name="M_PRODUCT_PO_VENDORPRODNO">
         <unique-column name="C_BPARTNER_ID"/>
         <unique-column name="VENDORPRODUCTNO"/>
--- a/database/model/tables/M_STORAGE_DETAIL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_STORAGE_DETAIL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -34,12 +34,12 @@
       <foreign-key foreignTable="M_LOCATOR" name="MLOCATOR_MSTORAGEDETAIL">
         <reference local="M_LOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MSTORAGEDETAIL">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOM_MSTORAGEDETAIL">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MSTORAGEDETAIL">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <unique name="M_STORAGE_DETAIL_UN">
         <unique-column name="M_PRODUCT_ID"/>
         <unique-column name="M_LOCATOR_ID"/>
--- a/database/model/tables/M_STORAGE_PENDING.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_STORAGE_PENDING.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -30,12 +30,12 @@
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRIBUTE_MSTORAGEPENDING">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MSTORAGEPENDING">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOM_MSTORAGEPENDING">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MSTORAGEPENDING">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_WAREHOUSE" name="MWAREHOUSE_MSTORAGEPENDING">
         <reference local="M_WAREHOUSE_ID" foreign="M_WAREHOUSE_ID"/>
       </foreign-key>
--- a/database/model/tables/M_SUBSTITUTE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_SUBSTITUTE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -11,18 +11,18 @@
       <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" default="SYSDATE" autoIncrement="false"/>
       <column name="UPDATEDBY" primaryKey="false" required="true" type="DECIMAL" size="10,0" autoIncrement="false"/>
       <column name="NAME" primaryKey="false" required="false" type="NVARCHAR" size="60" autoIncrement="false"/>
+      <foreign-key foreignTable="AD_CLIENT" name="M_SUBSTITUTE_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="M_SUBSTITUTE_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_SUBSTITUTE" onDelete="cascade">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_SUBSTITUTESUB" onDelete="cascade">
         <reference local="SUBSTITUTE_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_CLIENT" name="M_SUBSTITUTE_CLIENT">
-        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="M_SUBSTITUTE_ORG">
-        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
-      </foreign-key>
       <check name="M_SUBSTITUTE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/M_TRANSACTION.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/M_TRANSACTION.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -36,6 +36,9 @@
       <foreign-key foreignTable="C_UOM" name="CUOM_MTRANSACTION">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_INTERNAL_CONSUMPTION" name="M_INTL_CONSUMP_MTRANSACTION">
+        <reference local="M_INTERNAL_CONSUMPTIONLINE_ID" foreign="M_INTERNAL_CONSUMPTION_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_ATTRIBUTESETINSTANCE" name="MATTRIBUTESETINSTANCE_MTRANSAC">
         <reference local="M_ATTRIBUTESETINSTANCE_ID" foreign="M_ATTRIBUTESETINSTANCE_ID"/>
       </foreign-key>
@@ -51,18 +54,15 @@
       <foreign-key foreignTable="M_MOVEMENTLINE" name="MMOVEMENTLINE_MTRANSACTION">
         <reference local="M_MOVEMENTLINE_ID" foreign="M_MOVEMENTLINE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINVENTORYCOUNT">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCTIONLINE" name="MPRODUCTIONLINE_MTRANSACTION">
         <reference local="M_PRODUCTIONLINE_ID" foreign="M_PRODUCTIONLINE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_UOM" name="MPRODUCTUOM_MTRANSACTION">
         <reference local="M_PRODUCT_UOM_ID" foreign="M_PRODUCT_UOM_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_MINVENTORYCOUNT">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
-      <foreign-key foreignTable="M_INTERNAL_CONSUMPTION" name="M_INTL_CONSUMP_MTRANSACTION">
-        <reference local="M_INTERNAL_CONSUMPTIONLINE_ID" foreign="M_INTERNAL_CONSUMPTION_ID"/>
-      </foreign-key>
       <index name="M_TRANSSACTION_PRODUCT" unique="false">
         <index-column name="M_PRODUCT_ID"/>
       </index>
--- a/database/model/tables/PA_GOAL.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/PA_GOAL.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -27,12 +27,12 @@
       <foreign-key foreignTable="AD_ORG" name="ADORG_PAGOAL">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="PA_GOAL" name="PA_GOAL_PARENT">
+        <reference local="PARENT_ID" foreign="PA_GOAL_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="PA_MEASURE" name="PAMEASURE_PAGOAL">
         <reference local="PA_MEASURE_ID" foreign="PA_MEASURE_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="PA_GOAL" name="PA_GOAL_PARENT">
-        <reference local="PARENT_ID" foreign="PA_GOAL_ID"/>
-      </foreign-key>
       <check name="PA_GOAL_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/database/model/tables/PA_MEASURE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/PA_MEASURE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -36,12 +36,12 @@
       <foreign-key foreignTable="C_BP_GROUP" name="CBPGROUP_PAMEASURE">
         <reference local="C_BP_GROUP_ID" foreign="C_BP_GROUP_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_PAMEASURE">
+        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT_CATEGORY" name="MPRODUCTCATEGORY_PAMEASURE">
         <reference local="M_PRODUCT_CATEGORY_ID" foreign="M_PRODUCT_CATEGORY_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_PAMEASURE">
-        <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="PA_ACHIEVEMENT" name="PAACHIEVEMENT_PAMEASURE">
         <reference local="PA_ACHIEVEMENT_ID" foreign="PA_ACHIEVEMENT_ID"/>
       </foreign-key>
--- a/database/model/tables/PA_REPORTCOLUMN.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/PA_REPORTCOLUMN.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -71,15 +71,15 @@
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_PAREPORTCOLUMN">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="PA_REPORTCOLUMNSET" name="PAREPORTCOLUMNSET_COLUMN">
-        <reference local="PA_REPORTCOLUMNSET_ID" foreign="PA_REPORTCOLUMNSET_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="PA_REPORTCOLUMN" name="PAREPORTCOLUMN_OPER1">
         <reference local="OPER_1_ID" foreign="PA_REPORTCOLUMN_ID"/>
       </foreign-key>
       <foreign-key foreignTable="PA_REPORTCOLUMN" name="PAREPORTCOLUMN_OPER2">
         <reference local="OPER_2_ID" foreign="PA_REPORTCOLUMN_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="PA_REPORTCOLUMNSET" name="PAREPORTCOLUMNSET_COLUMN">
+        <reference local="PA_REPORTCOLUMNSET_ID" foreign="PA_REPORTCOLUMNSET_ID"/>
+      </foreign-key>
       <check name="PAREPORTCOLUMN_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="PAREPORTCOLUMN_ISADCONV_CHECK"><![CDATA[ISADHOCCONVERSION IN ('Y', 'N')]]></check>
       <check name="PAREPORTCOLUMN_ISPRINTED_CHECK"><![CDATA[ISPRINTED IN ('Y', 'N')]]></check>
--- a/database/model/tables/PA_REPORTLINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/PA_REPORTLINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -32,9 +32,6 @@
       <foreign-key foreignTable="GL_BUDGET" name="GLBUDGET_PAREPORTLINE">
         <reference local="GL_BUDGET_ID" foreign="GL_BUDGET_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="PA_REPORTLINESET" name="PAREPORTLINESET_LINE">
-        <reference local="PA_REPORTLINESET_ID" foreign="PA_REPORTLINESET_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="PA_REPORTLINE" name="PAREPORTLINE_OPER1">
         <reference local="OPER_1_ID" foreign="PA_REPORTLINE_ID"/>
       </foreign-key>
@@ -44,6 +41,9 @@
       <foreign-key foreignTable="PA_REPORTLINE" name="PAREPORTLINE_PARENT">
         <reference local="PARENT_ID" foreign="PA_REPORTLINE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="PA_REPORTLINESET" name="PAREPORTLINESET_LINE">
+        <reference local="PA_REPORTLINESET_ID" foreign="PA_REPORTLINESET_ID"/>
+      </foreign-key>
       <check name="PAREPORTLINE_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="PAREPORTLINE_ISPRINTED_CHECK"><![CDATA[ISPRINTED IN ('Y', 'N')]]></check>
     </table>
--- a/database/model/tables/R_REQUEST.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/R_REQUEST.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -49,6 +49,9 @@
       <foreign-key foreignTable="AD_USER" name="ADUSER_SR_RREQUEST">
         <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_BPARTNER" name="C_BPARTNER_RREQUEST">
+        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_CAMPAIGN" name="CCAMPAIGN_RREQUEST">
         <reference local="C_CAMPAIGN_ID" foreign="C_CAMPAIGN_ID"/>
       </foreign-key>
@@ -61,9 +64,6 @@
       <foreign-key foreignTable="C_PROJECT" name="CPROJECT_RREQUEST">
         <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_BPARTNER" name="C_BPARTNER_RREQUEST">
-        <reference local="C_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="M_PRODUCT" name="MPRODUCT_RREQUEST">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
--- a/database/model/tables/S_TIMEEXPENSELINE.xml	Mon Feb 11 13:16:25 2008 +0000
+++ b/database/model/tables/S_TIMEEXPENSELINE.xml	Mon Feb 11 14:32:48 2008 +0000
@@ -57,15 +57,15 @@
       <foreign-key foreignTable="C_ORDERLINE" name="CORDERLINE_STIMEEXPENSELINE">
         <reference local="C_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_PROJECT" name="CPROJECT_STIMEEXPENSELINE">
+        <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_PROJECTPHASE" name="CPROJECTPHASE_STIMEEXPENSELINE">
         <reference local="C_PROJECTPHASE_ID" foreign="C_PROJECTPHASE_ID"/>
       </foreign-key>
       <foreign-key foreignTable="C_PROJECTTASK" name="CPROJECTTASK_STIMEEXPENSELINE">
         <reference local="C_PROJECTTASK_ID" foreign="C_PROJECTTASK_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="C_PROJECT" name="CPROJECT_STIMEEXPENSELINE">
-        <reference local="C_PROJECT_ID" foreign="C_PROJECT_ID"/>
-      </foreign-key>
       <foreign-key foreignTable="C_UOM" name="CUOM_STIMEEXPENSELINE">
         <reference local="C_UOM_ID" foreign="C_UOM_ID"/>
       </foreign-key>