Changes required to support PostgreSQL 9.2
authorAntonio Moreno <antonio.moreno@openbravo.com>
Mon, 04 Feb 2013 09:27:53 +0100
changeset 9910 6767429386d8
parent 9909 56a1306e07a0
child 9911 444911e2b851
Changes required to support PostgreSQL 9.2
src-db/database/lib/dbsourcemanager.jar
src-db/database/model/views/AD_AUDIT_TRAIL_V.xml
src-db/database/model/views/AD_FIELD_V.xml
src-db/database/model/views/AD_FIELD_VT.xml
src-db/database/model/views/AD_ORGMODULE_V.xml
src-db/database/model/views/AD_PROCESS_EXECUTION_V.xml
src-db/database/model/views/AD_REF_LIST_V.xml
src-db/database/model/views/AD_TABLE_POST_V.xml
src-db/database/model/views/AD_TAB_V.xml
src-db/database/model/views/AD_TAB_VT.xml
src-db/database/model/views/AD_USER_ROLES_V.xml
src-db/database/model/views/AD_WINDOW_VT.xml
src-db/database/model/views/A_ASSET_AMORTIZATION.xml
src-db/database/model/views/C_BPARTNER_V.xml
src-db/database/model/views/C_CASH_DETAIL.xml
src-db/database/model/views/C_DEBT_PAYMENT_CANCEL.xml
src-db/database/model/views/C_DEBT_PAYMENT_GENERATE.xml
src-db/database/model/views/C_DEBT_PAYMENT_V.xml
src-db/database/model/views/C_INVOICELINE_V.xml
src-db/database/model/views/C_INVOICELINE_V2.xml
src-db/database/model/views/C_INVOICE_CANDIDATE_V.xml
src-db/database/model/views/C_INVOICE_CUSTOMERPRODQTR.xml
src-db/database/model/views/C_INVOICE_CUSTOMERVENDQTR.xml
src-db/database/model/views/C_INVOICE_DAY.xml
src-db/database/model/views/C_INVOICE_HEADER_V.xml
src-db/database/model/views/C_INVOICE_HEADER_VT.xml
src-db/database/model/views/C_INVOICE_LINETAX_V.xml
src-db/database/model/views/C_INVOICE_LINETAX_VT.xml
src-db/database/model/views/C_INVOICE_MONTH.xml
src-db/database/model/views/C_INVOICE_PRODMONTH.xml
src-db/database/model/views/C_INVOICE_PRODWEEK.xml
src-db/database/model/views/C_INVOICE_V.xml
src-db/database/model/views/C_INVOICE_V2.xml
src-db/database/model/views/C_INVOICE_VENDORMONTH.xml
src-db/database/model/views/C_INVOICE_WEEK.xml
src-db/database/model/views/C_ORDER_HEADER_V.xml
src-db/database/model/views/C_ORDER_HEADER_VT.xml
src-db/database/model/views/C_ORDER_LINETAX_V.xml
src-db/database/model/views/C_ORDER_LINETAX_VT.xml
src-db/database/model/views/C_ORDER_OPEN.xml
src-db/database/model/views/C_PERIODCONTROL_V.xml
src-db/database/model/views/C_PROJECTPROPOSAL_V.xml
src-db/database/model/views/C_PROJECT_DETAILS_V.xml
src-db/database/model/views/C_PROJECT_DETAILS_VT.xml
src-db/database/model/views/C_PROJECT_HEADER_V.xml
src-db/database/model/views/C_PROJECT_HEADER_VT.xml
src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml
src-db/database/model/views/FIN_PAYMENT_EXEC_HISTORY_V.xml
src-db/database/model/views/FIN_PAYMENT_PROP_DETAIL_V.xml
src-db/database/model/views/FIN_PAYMENT_SCHED_INV_V.xml
src-db/database/model/views/FIN_PAYMENT_SCHED_ORD_V.xml
src-db/database/model/views/FIN_RECONCILIATIONLINE_V.xml
src-db/database/model/views/GL_JOURNALLINE_ACCT_V.xml
src-db/database/model/views/MA_PROCESSPLAN_TOTALIZED.xml
src-db/database/model/views/MA_SEQUENCE_EMPLOYEE_COST.xml
src-db/database/model/views/MA_SEQUENCE_INDIRECT_COST_COST.xml
src-db/database/model/views/MA_SEQUENCE_MACHINE_COST.xml
src-db/database/model/views/M_INOUT_CANDIDATE_V.xml
src-db/database/model/views/M_INOUT_HEADER_V.xml
src-db/database/model/views/M_INOUT_HEADER_VT.xml
src-db/database/model/views/M_INOUT_LINE_V.xml
src-db/database/model/views/M_INOUT_LINE_VT.xml
src-db/database/model/views/M_TRANSACTION_SUM.xml
src-db/database/model/views/M_TRANSACTION_V.xml
src-db/database/model/views/R_REQUEST_V.xml
src-db/database/model/views/S_TIMEEXPENSELINE_V.xml
src-wad/src/org/openbravo/wad/Fields_data.xsql
Binary file src-db/database/lib/dbsourcemanager.jar has changed
--- a/src-db/database/model/views/AD_AUDIT_TRAIL_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_AUDIT_TRAIL_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,17 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_AUDIT_TRAIL_V">
-    <view name="AD_AUDIT_TRAIL_V"><![CDATA[SELECT at.ad_audit_trail_id, at.ad_client_id, at.ad_org_id, at.isactive, at.created, at.createdby, at.updated, at.updatedby, at.ad_table_id, at.record_id, at.record_revision, at.ad_user_id, at.event_time, at.processtype, at.process_id, at.action, at.ad_column_id, at.old_char, at.new_char, at.old_nchar, at.new_nchar, at.old_number, at.new_number, at.old_date, at.new_date, 
-CASE
-WHEN at.processtype = 'P' THEN (SELECT to_char(p.name) AS to_char
-FROM ad_process p
-WHERE p.ad_process_id = at.process_id)
-WHEN at.processtype = 'W' THEN (SELECT to_char(w.name) AS to_char
-FROM ad_tab t, ad_window w
-WHERE t.ad_tab_id = at.process_id AND t.ad_window_id = w.ad_window_id)
-WHEN at.processtype = 'X' THEN (SELECT to_char(f.name) AS to_char
-FROM ad_form f
-WHERE f.ad_form_id = at.process_id)
-ELSE ''
-END AS process_desc, COALESCE(at.old_char, to_char(at.old_nchar), to_char(at.old_date), to_char(at.old_number)) AS old_value, COALESCE(at.new_char, to_char(at.new_nchar), to_char(at.new_date), to_char(at.new_number)) AS new_value
-FROM ad_audit_trail at]]></view>
+    <view name="AD_AUDIT_TRAIL_V"><![CDATA[SELECT at.ad_audit_trail_id, at.ad_client_id, at.ad_org_id, at.isactive,  at.created, at.createdby, at.updated, at.updatedby, at.ad_table_id,  at.record_id, at.record_revision, at.ad_user_id, at.event_time,  at.processtype, at.process_id, at.action, at.ad_column_id, at.old_char,  at.new_char, at.old_nchar, at.new_nchar, at.old_number, at.new_number,  at.old_date, at.new_date,  CASE WHEN at.processtype = 'P' THEN (SELECT to_char(p.name) AS to_char FROM ad_process p WHERE p.ad_process_id = at.process_id) WHEN at.processtype = 'W' THEN (SELECT to_char(w.name) AS to_char FROM ad_tab t, ad_window w WHERE t.ad_tab_id = at.process_id AND t.ad_window_id = w.ad_window_id) WHEN at.processtype = 'X' THEN (SELECT to_char(f.name) AS to_char FROM ad_form f WHERE f.ad_form_id = at.process_id) ELSE '' END AS process_desc,  COALESCE(at.old_char, to_char(at.old_nchar), to_char(at.old_date), to_char(at.old_number)) AS old_value,  COALESCE(at.new_char, to_char(at.new_nchar), to_char(at.new_date), to_char(at.new_number)) AS new_value FROM ad_audit_trail at]]></view>
   </database>
--- a/src-db/database/model/views/AD_FIELD_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_FIELD_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,12 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_FIELD_V">
-    <view name="AD_FIELD_V"><![CDATA[SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, f.name, f.description, f.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, c.columnname, c.fieldlength, c.vformat, c.defaultvalue, c.iskey, c.isparent, c.ismandatory, c.isidentifier, c.istranslated, c.ad_reference_value_id, c.callout, c.ad_reference_id, c.ad_val_rule_id, c.ad_process_id, c.readonlylogic, c.isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fg.name AS fieldgroup, vr.code AS validationcode
-FROM ad_field f
-JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
-LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id
-LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
-JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
-JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id
-LEFT JOIN ad_val_rule vr ON c.ad_val_rule_id = vr.ad_val_rule_id
-WHERE f.isactive = 'Y' AND c.isactive = 'Y']]></view>
+    <view name="AD_FIELD_V"><![CDATA[SELECT t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id,  f.ad_column_id, f.name, f.description, f.help, f.isdisplayed,  f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline,  f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield,  c.columnname, c.fieldlength, c.vformat, c.defaultvalue, c.iskey, c.isparent,  c.ismandatory, c.isidentifier, c.istranslated, c.ad_reference_value_id,  c.callout, c.ad_reference_id, c.ad_val_rule_id, c.ad_process_id,  c.readonlylogic, c.isupdateable, c.isencrypted AS isencryptedcolumn,  c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax,  fg.name AS fieldgroup, vr.code AS validationcode FROM ad_field f JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id LEFT JOIN ad_fieldgroup fg ON f.ad_fieldgroup_id = fg.ad_fieldgroup_id LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id LEFT JOIN ad_val_rule vr ON c.ad_val_rule_id = vr.ad_val_rule_id WHERE f.isactive = 'Y' AND c.isactive = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/AD_FIELD_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_FIELD_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,13 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_FIELD_VT">
-    <view name="AD_FIELD_VT"><![CDATA[SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id, tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help, f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno, f.issameline, f.isfieldonly, f.isreadonly, f.isencrypted AS isencryptedfield, c.columnname, c.fieldlength, c.vformat, c.defaultvalue, c.iskey, c.isparent, c.ismandatory, c.isidentifier, c.istranslated, c.ad_reference_value_id, c.callout, c.ad_reference_id, c.ad_val_rule_id, c.ad_process_id, c.readonlylogic, c.isupdateable, c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename, c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode
-FROM ad_field f
-JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id
-JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id
-LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language = fgt.ad_language
-LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id
-JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id
-JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id
-LEFT JOIN ad_val_rule vr ON c.ad_val_rule_id = vr.ad_val_rule_id
-WHERE f.isactive = 'Y' AND c.isactive = 'Y']]></view>
+    <view name="AD_FIELD_VT"><![CDATA[SELECT trl.ad_language, t.ad_window_id, f.ad_tab_id, f.ad_field_id,  tbl.ad_table_id, f.ad_column_id, trl.name, trl.description, trl.help,  f.isdisplayed, f.displaylogic, f.displaylength, f.seqno, f.sortno,  f.issameline, f.isfieldonly, f.isreadonly,  f.isencrypted AS isencryptedfield, c.columnname, c.fieldlength, c.vformat,  c.defaultvalue, c.iskey, c.isparent, c.ismandatory, c.isidentifier,  c.istranslated, c.ad_reference_value_id, c.callout, c.ad_reference_id,  c.ad_val_rule_id, c.ad_process_id, c.readonlylogic, c.isupdateable,  c.isencrypted AS isencryptedcolumn, c.isselectioncolumn, tbl.tablename,  c.valuemin, c.valuemax, fgt.name AS fieldgroup, vr.code AS validationcode FROM ad_field f JOIN ad_field_trl trl ON f.ad_field_id = trl.ad_field_id JOIN ad_tab t ON f.ad_tab_id = t.ad_tab_id LEFT JOIN ad_fieldgroup_trl fgt ON f.ad_fieldgroup_id = fgt.ad_fieldgroup_id AND trl.ad_language = fgt.ad_language LEFT JOIN ad_column c ON f.ad_column_id = c.ad_column_id JOIN ad_table tbl ON c.ad_table_id = tbl.ad_table_id JOIN ad_reference r ON c.ad_reference_id = r.ad_reference_id LEFT JOIN ad_val_rule vr ON c.ad_val_rule_id = vr.ad_val_rule_id WHERE f.isactive = 'Y' AND c.isactive = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/AD_ORGMODULE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_ORGMODULE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,10 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_ORGMODULE_V">
-    <view name="AD_ORGMODULE_V"><![CDATA[SELECT ad_orgmodule.ad_orgmodule_id || ad_dataset.ad_dataset_id AS ad_orgmodule_v_id, ad_orgmodule.ad_org_id, ad_orgmodule.ad_client_id, ad_orgmodule.created, ad_orgmodule.isactive, ad_orgmodule.createdby, ad_orgmodule.updated, ad_orgmodule.updatedby, ad_dataset.ad_module_id, ad_orgmodule.version, ad_dataset.ad_dataset_id, ad_dataset.description, 
-CASE
-WHEN instr(ad_orgmodule.checksum, ad_dataset.checksum) = 0 THEN 'Y'
-ELSE 'N'
-END AS update_available
-FROM ad_orgmodule, ad_dataset
-WHERE ad_orgmodule.ad_module_id = ad_dataset.ad_module_id]]></view>
+    <view name="AD_ORGMODULE_V"><![CDATA[SELECT ad_orgmodule.ad_orgmodule_id || ad_dataset.ad_dataset_id AS ad_orgmodule_v_id,  ad_orgmodule.ad_org_id, ad_orgmodule.ad_client_id, ad_orgmodule.created,  ad_orgmodule.isactive, ad_orgmodule.createdby, ad_orgmodule.updated,  ad_orgmodule.updatedby, ad_dataset.ad_module_id, ad_orgmodule.version,  ad_dataset.ad_dataset_id, ad_dataset.description,  CASE WHEN instr(ad_orgmodule.checksum, ad_dataset.checksum) = 0 THEN 'Y' ELSE 'N' END AS update_available FROM ad_orgmodule, ad_dataset WHERE ad_orgmodule.ad_module_id = ad_dataset.ad_module_id]]></view>
   </database>
--- a/src-db/database/model/views/AD_PROCESS_EXECUTION_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_PROCESS_EXECUTION_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_PROCESS_EXECUTION_V">
-    <view name="AD_PROCESS_EXECUTION_V"><![CDATA[SELECT rn.ad_process_run_id, rn.ad_client_id, rn.ad_org_id, rn.isactive, rn.created, rn.createdby, rn.updated, rn.updatedby, rq.ad_user_id, rn.status, rn.start_time, rn.end_time, rn.runtime, rn.log, rn.result, rq.params, rn.report, rq.channel, rq.isrolesecurity, rq.ad_process_id, rn.ad_process_request_id
-FROM ad_process_run rn
-LEFT JOIN ad_process_request rq ON rn.ad_process_request_id = rq.ad_process_request_id]]></view>
+    <view name="AD_PROCESS_EXECUTION_V"><![CDATA[SELECT rn.ad_process_run_id, rn.ad_client_id, rn.ad_org_id, rn.isactive,  rn.created, rn.createdby, rn.updated, rn.updatedby, rq.ad_user_id,  rn.status, rn.start_time, rn.end_time, rn.runtime, rn.log, rn.result,  rq.params, rn.report, rq.channel, rq.isrolesecurity, rq.ad_process_id,  rn.ad_process_request_id FROM ad_process_run rn LEFT JOIN ad_process_request rq ON rn.ad_process_request_id = rq.ad_process_request_id]]></view>
   </database>
--- a/src-db/database/model/views/AD_REF_LIST_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_REF_LIST_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,13 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_REF_LIST_V">
-    <view name="AD_REF_LIST_V"><![CDATA[SELECT ad_ref_list.ad_ref_list_id, ad_ref_list.value, to_char(ad_ref_list.name) AS name, 'en_US' AS ad_language, ad_ref_list.ad_reference_id
-FROM ad_ref_list
-UNION 
-SELECT v1.ad_ref_list_id, v1.value, COALESCE(v1.name_trl, v2.name) AS name, v1.ad_language, v1.ad_reference_id
-FROM (SELECT ad_ref_list.ad_ref_list_id, ad_ref_list.value, to_char(ad_ref_list_trl.name) AS name_trl, '' AS name, ad_ref_list_trl.ad_language, ad_ref_list.ad_reference_id
-FROM ad_ref_list, ad_ref_list_trl
-WHERE ad_ref_list.ad_ref_list_id = ad_ref_list_trl.ad_ref_list_id) v1, (SELECT ad_ref_list.ad_ref_list_id, ad_ref_list.value, to_char(ad_ref_list.name) AS name, ad_language.ad_language, ad_ref_list.ad_reference_id
-FROM ad_ref_list, ad_language
-WHERE ad_language.issystemlanguage = 'Y') v2
-WHERE v1.ad_ref_list_id = v2.ad_ref_list_id AND v1.ad_reference_id = v2.ad_reference_id]]></view>
+    <view name="AD_REF_LIST_V"><![CDATA[SELECT ad_ref_list.ad_ref_list_id, ad_ref_list.value,  to_char(ad_ref_list.name) AS name,  'en_US' AS ad_language,  ad_ref_list.ad_reference_id FROM ad_ref_list UNION  SELECT v1.ad_ref_list_id, v1.value,  COALESCE(v1.name_trl, v2.name) AS name, v1.ad_language,  v1.ad_reference_id FROM (SELECT ad_ref_list.ad_ref_list_id, ad_ref_list.value,  to_char(ad_ref_list_trl.name) AS name_trl, '' AS name,  ad_ref_list_trl.ad_language, ad_ref_list.ad_reference_id FROM ad_ref_list, ad_ref_list_trl WHERE ad_ref_list.ad_ref_list_id = ad_ref_list_trl.ad_ref_list_id) v1,  (SELECT ad_ref_list.ad_ref_list_id, ad_ref_list.value,  to_char(ad_ref_list.name) AS name, ad_language.ad_language,  ad_ref_list.ad_reference_id FROM ad_ref_list, ad_language WHERE ad_language.issystemlanguage = 'Y') v2 WHERE v1.ad_ref_list_id = v2.ad_ref_list_id AND v1.ad_reference_id = v2.ad_reference_id]]></view>
   </database>
--- a/src-db/database/model/views/AD_TABLE_POST_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_TABLE_POST_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,26 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_TABLE_POST_V">
-    <view name="AD_TABLE_POST_V"><![CDATA[SELECT ad_table.ad_table_id, (((ad_table.tablename || ' (') || (COALESCE(to_char(w2.name), '') || 
-CASE
-WHEN w2.name IS NULL THEN ''
-ELSE ' - '
-END)) || COALESCE(to_char(w1.name), ' - ')) || ')' AS name, w1.ad_language, ad_table.ad_client_id, ad_table.ad_org_id, ad_table.isactive, ad_table.created, ad_table.createdby, ad_table.updated, ad_table.updatedby
-FROM ad_table
-LEFT JOIN ad_window_trl w1 ON ad_table.ad_window_id = w1.ad_window_id
-LEFT JOIN ad_window_trl w2 ON ad_table.po_window_id = w2.ad_window_id
-WHERE (EXISTS (SELECT c.ad_column_id, c.ad_client_id, c.ad_org_id, c.isactive, c.created, c.updated, c.createdby, c.updatedby, c.name, c.description, c.help, c.columnname, c.ad_table_id, c.ad_reference_id, c.ad_reference_value_id, c.ad_val_rule_id, c.fieldlength, c.defaultvalue, c.iskey, c.isparent, c.ismandatory, c.isupdateable, c.readonlylogic, c.isidentifier, c.seqno, c.istranslated, c.isencrypted, c.callout, c.vformat, c.valuemin, c.valuemax, c.isselectioncolumn, c.ad_element_id, c.ad_process_id, c.issessionattr, c.issecondarykey, c.isdesencryptable, c.ad_callout_id, c.developmentstatus
-FROM ad_column c
-WHERE ad_table.ad_table_id = c.ad_table_id AND c.columnname = 'Posted')) AND w1.ad_language = COALESCE(w2.ad_language, w1.ad_language) AND ad_table.isactive = 'Y'
-UNION 
-SELECT ad_table.ad_table_id, (((ad_table.tablename || ' (') || (COALESCE(to_char(w2.name), '') || 
-CASE
-WHEN w2.name IS NULL THEN ''
-ELSE ' - '
-END)) || COALESCE(to_char(w1.name), ' - ')) || ')' AS name, 'en_US' AS ad_language, ad_table.ad_client_id, ad_table.ad_org_id, ad_table.isactive, ad_table.created, ad_table.createdby, ad_table.updated, ad_table.updatedby
-FROM ad_table
-LEFT JOIN ad_window w1 ON ad_table.ad_window_id = w1.ad_window_id
-LEFT JOIN ad_window w2 ON ad_table.po_window_id = w2.ad_window_id
-WHERE (EXISTS (SELECT c.ad_column_id, c.ad_client_id, c.ad_org_id, c.isactive, c.created, c.updated, c.createdby, c.updatedby, c.name, c.description, c.help, c.columnname, c.ad_table_id, c.ad_reference_id, c.ad_reference_value_id, c.ad_val_rule_id, c.fieldlength, c.defaultvalue, c.iskey, c.isparent, c.ismandatory, c.isupdateable, c.readonlylogic, c.isidentifier, c.seqno, c.istranslated, c.isencrypted, c.callout, c.vformat, c.valuemin, c.valuemax, c.isselectioncolumn, c.ad_element_id, c.ad_process_id, c.issessionattr, c.issecondarykey, c.isdesencryptable, c.ad_callout_id, c.developmentstatus
-FROM ad_column c
-WHERE ad_table.ad_table_id = c.ad_table_id AND c.columnname = 'Posted')) AND ad_table.isactive = 'Y']]></view>
+    <view name="AD_TABLE_POST_V"><![CDATA[SELECT ad_table.ad_table_id,  (((ad_table.tablename || ' (') || (COALESCE(to_char(w2.name), '') ||  CASE WHEN w2.name IS NULL THEN '' ELSE ' - ' END)) || COALESCE(to_char(w1.name), ' - ')) || ')' AS name,  w1.ad_language, ad_table.ad_client_id, ad_table.ad_org_id,  ad_table.isactive, ad_table.created, ad_table.createdby,  ad_table.updated, ad_table.updatedby FROM ad_table LEFT JOIN ad_window_trl w1 ON ad_table.ad_window_id = w1.ad_window_id LEFT JOIN ad_window_trl w2 ON ad_table.po_window_id = w2.ad_window_id WHERE (EXISTS (SELECT c.ad_column_id, c.ad_client_id, c.ad_org_id,  c.isactive, c.created, c.updated, c.createdby, c.updatedby, c.name,  c.description, c.help, c.columnname, c.ad_table_id, c.ad_reference_id,  c.ad_reference_value_id, c.ad_val_rule_id, c.fieldlength,  c.defaultvalue, c.iskey, c.isparent, c.ismandatory, c.isupdateable,  c.readonlylogic, c.isidentifier, c.seqno, c.istranslated,  c.isencrypted, c.callout, c.vformat, c.valuemin, c.valuemax,  c.isselectioncolumn, c.ad_element_id, c.ad_process_id,  c.issessionattr, c.issecondarykey, c.isdesencryptable,  c.ad_callout_id, c.developmentstatus FROM ad_column c WHERE ad_table.ad_table_id = c.ad_table_id AND c.columnname = 'Posted')) AND w1.ad_language = COALESCE(w2.ad_language, w1.ad_language) AND ad_table.isactive = 'Y' UNION  SELECT ad_table.ad_table_id,  (((ad_table.tablename || ' (') || (COALESCE(to_char(w2.name), '') ||  CASE WHEN w2.name IS NULL THEN '' ELSE ' - ' END)) || COALESCE(to_char(w1.name), ' - ')) || ')' AS name,  'en_US' AS ad_language, ad_table.ad_client_id,  ad_table.ad_org_id, ad_table.isactive, ad_table.created,  ad_table.createdby, ad_table.updated, ad_table.updatedby FROM ad_table LEFT JOIN ad_window w1 ON ad_table.ad_window_id = w1.ad_window_id LEFT JOIN ad_window w2 ON ad_table.po_window_id = w2.ad_window_id WHERE (EXISTS (SELECT c.ad_column_id, c.ad_client_id, c.ad_org_id,  c.isactive, c.created, c.updated, c.createdby, c.updatedby, c.name,  c.description, c.help, c.columnname, c.ad_table_id, c.ad_reference_id,  c.ad_reference_value_id, c.ad_val_rule_id, c.fieldlength,  c.defaultvalue, c.iskey, c.isparent, c.ismandatory, c.isupdateable,  c.readonlylogic, c.isidentifier, c.seqno, c.istranslated,  c.isencrypted, c.callout, c.vformat, c.valuemin, c.valuemax,  c.isselectioncolumn, c.ad_element_id, c.ad_process_id,  c.issessionattr, c.issecondarykey, c.isdesencryptable,  c.ad_callout_id, c.developmentstatus FROM ad_column c WHERE ad_table.ad_table_id = c.ad_table_id AND c.columnname = 'Posted')) AND ad_table.isactive = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/AD_TAB_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_TAB_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,7 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_TAB_V">
-    <view name="AD_TAB_V"><![CDATA[SELECT t.ad_tab_id, t.ad_window_id, t.ad_table_id, t.name, t.description, t.help, t.seqno, t.issinglerow, t.hastree, t.isinfotab, tbl.tablename, tbl.accesslevel, tbl.issecurityenabled, tbl.isdeleteable, tbl.ishighvolume, tbl.isview, to_char('N') AS hasassociation, t.istranslationtab, t.isreadonly, t.ad_image_id, t.tablevel, t.whereclause, t.orderbyclause, t.commitwarning, t.ad_column_id, t.ad_process_id, t.issorttab, t.ad_columnsortorder_id, t.ad_columnsortyesno_id, t.included_tab_id
-FROM ad_tab t
-JOIN ad_table tbl ON t.ad_table_id = tbl.ad_table_id
-WHERE t.isactive = 'Y' AND tbl.isactive = 'Y']]></view>
+    <view name="AD_TAB_V"><![CDATA[SELECT t.ad_tab_id, t.ad_window_id, t.ad_table_id, t.name, t.description,  t.help, t.seqno, t.issinglerow, t.hastree, t.isinfotab, tbl.tablename,  tbl.accesslevel, tbl.issecurityenabled, tbl.isdeleteable, tbl.ishighvolume,  tbl.isview, to_char('N') AS hasassociation, t.istranslationtab,  t.isreadonly, t.ad_image_id, t.tablevel, t.whereclause, t.orderbyclause,  t.commitwarning, t.ad_column_id, t.ad_process_id, t.issorttab,  t.ad_columnsortorder_id, t.ad_columnsortyesno_id, t.included_tab_id FROM ad_tab t JOIN ad_table tbl ON t.ad_table_id = tbl.ad_table_id WHERE t.isactive = 'Y' AND tbl.isactive = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/AD_TAB_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_TAB_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,8 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_TAB_VT">
-    <view name="AD_TAB_VT"><![CDATA[SELECT trl.ad_language, t.ad_tab_id, t.ad_window_id, t.ad_table_id, trl.name, trl.description, trl.help, t.seqno, t.issinglerow, t.hastree, t.isinfotab, tbl.tablename, tbl.accesslevel, tbl.issecurityenabled, tbl.isdeleteable, tbl.ishighvolume, tbl.isview, to_char('N') AS hasassociation, t.istranslationtab, t.isreadonly, t.ad_image_id, t.tablevel, t.whereclause, t.orderbyclause, t.commitwarning, t.ad_column_id, t.ad_process_id, t.issorttab, t.ad_columnsortorder_id, t.ad_columnsortyesno_id, t.included_tab_id
-FROM ad_tab t
-JOIN ad_table tbl ON t.ad_table_id = tbl.ad_table_id
-JOIN ad_tab_trl trl ON t.ad_tab_id = trl.ad_tab_id
-WHERE t.isactive = 'Y' AND tbl.isactive = 'Y']]></view>
+    <view name="AD_TAB_VT"><![CDATA[SELECT trl.ad_language, t.ad_tab_id, t.ad_window_id, t.ad_table_id, trl.name,  trl.description, trl.help, t.seqno, t.issinglerow, t.hastree, t.isinfotab,  tbl.tablename, tbl.accesslevel, tbl.issecurityenabled, tbl.isdeleteable,  tbl.ishighvolume, tbl.isview, to_char('N') AS hasassociation,  t.istranslationtab, t.isreadonly, t.ad_image_id, t.tablevel, t.whereclause,  t.orderbyclause, t.commitwarning, t.ad_column_id, t.ad_process_id,  t.issorttab, t.ad_columnsortorder_id, t.ad_columnsortyesno_id,  t.included_tab_id FROM ad_tab t JOIN ad_table tbl ON t.ad_table_id = tbl.ad_table_id JOIN ad_tab_trl trl ON t.ad_tab_id = trl.ad_tab_id WHERE t.isactive = 'Y' AND tbl.isactive = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/AD_USER_ROLES_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_USER_ROLES_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,7 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_USER_ROLES_V">
-    <view name="AD_USER_ROLES_V"><![CDATA[SELECT u.name, r.name AS rolename
-FROM ad_user_roles ur
-JOIN ad_user u ON ur.ad_user_id = u.ad_user_id
-JOIN ad_role r ON ur.ad_role_id = r.ad_role_id]]></view>
+    <view name="AD_USER_ROLES_V"><![CDATA[SELECT u.name, r.name AS rolename FROM ad_user_roles ur JOIN ad_user u ON ur.ad_user_id = u.ad_user_id JOIN ad_role r ON ur.ad_role_id = r.ad_role_id]]></view>
   </database>
--- a/src-db/database/model/views/AD_WINDOW_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/AD_WINDOW_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,7 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW AD_WINDOW_VT">
-    <view name="AD_WINDOW_VT"><![CDATA[SELECT trl.ad_language, bt.ad_window_id, trl.name, trl.description, trl.help, bt.windowtype, bt.ad_image_id, bt.isactive
-FROM ad_window bt
-JOIN ad_window_trl trl ON bt.ad_window_id = trl.ad_window_id
-WHERE bt.isactive = 'Y']]></view>
+    <view name="AD_WINDOW_VT"><![CDATA[SELECT trl.ad_language, bt.ad_window_id, trl.name, trl.description, trl.help,  bt.windowtype, bt.ad_image_id, bt.isactive FROM ad_window bt JOIN ad_window_trl trl ON bt.ad_window_id = trl.ad_window_id WHERE bt.isactive = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/A_ASSET_AMORTIZATION.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/A_ASSET_AMORTIZATION.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW A_ASSET_AMORTIZATION">
-    <view name="A_ASSET_AMORTIZATION"><![CDATA[SELECT a_asset.ad_client_id, a_asset.ad_org_id, a_asset.isactive, a_asset.created, a_asset.createdby, a_asset.updated, a_asset.updatedby, a_asset.a_asset_id, a_amortization.a_amortization_id, a_amortization.startdate, a_amortization.enddate, a_amortizationline.amortization_percentage, a_amortizationline.amortizationamt
-FROM a_asset, a_amortization, a_amortizationline
-WHERE a_asset.a_asset_id = a_amortizationline.a_asset_id AND a_amortizationline.a_amortization_id = a_amortization.a_amortization_id]]></view>
+    <view name="A_ASSET_AMORTIZATION"><![CDATA[SELECT a_asset.ad_client_id, a_asset.ad_org_id, a_asset.isactive,  a_asset.created, a_asset.createdby, a_asset.updated, a_asset.updatedby,  a_asset.a_asset_id, a_amortization.a_amortization_id,  a_amortization.startdate, a_amortization.enddate,  a_amortizationline.amortization_percentage,  a_amortizationline.amortizationamt FROM a_asset, a_amortization, a_amortizationline WHERE a_asset.a_asset_id = a_amortizationline.a_asset_id AND a_amortizationline.a_amortization_id = a_amortization.a_amortization_id]]></view>
   </database>
--- a/src-db/database/model/views/C_BPARTNER_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_BPARTNER_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,8 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_BPARTNER_V">
-    <view name="C_BPARTNER_V"><![CDATA[SELECT p.ad_client_id, p.ad_org_id, p.c_bpartner_id, p.value, p.name, p.referenceno, p.so_creditlimit - p.so_creditused AS so_creditavailable, p.so_creditlimit, p.so_creditused, p.iscustomer, p.isvendor, p.actuallifetimevalue AS revenue, c.name AS contact, c.phone, a.postal, a.city, c.email
-FROM c_bpartner p
-LEFT JOIN ad_user c ON p.c_bpartner_id = c.c_bpartner_id
-LEFT JOIN c_bpartner_location l ON p.c_bpartner_id = l.c_bpartner_id
-LEFT JOIN c_location a ON l.c_location_id = a.c_location_id]]></view>
+    <view name="C_BPARTNER_V"><![CDATA[SELECT p.ad_client_id, p.ad_org_id, p.c_bpartner_id, p.value, p.name,  p.referenceno, p.so_creditlimit - p.so_creditused AS so_creditavailable,  p.so_creditlimit, p.so_creditused, p.iscustomer, p.isvendor,  p.actuallifetimevalue AS revenue, c.name AS contact, c.phone, a.postal,  a.city, c.email FROM c_bpartner p LEFT JOIN ad_user c ON p.c_bpartner_id = c.c_bpartner_id LEFT JOIN c_bpartner_location l ON p.c_bpartner_id = l.c_bpartner_id LEFT JOIN c_location a ON l.c_location_id = a.c_location_id]]></view>
   </database>
--- a/src-db/database/model/views/C_CASH_DETAIL.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_CASH_DETAIL.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_CASH_DETAIL">
-    <view name="C_CASH_DETAIL"><![CDATA[SELECT cl.c_cash_id, cl.c_cashline_id, c.ad_client_id, c.ad_org_id, cl.isactive, cl.created, cl.createdby, cl.updated, cl.updatedby, c.c_cashbook_id, c.name, c.statementdate, c.dateacct, c.processed, c.posted, cl.line, cl.description, cl.cashtype, cl.c_currency_id, cl.amount, c_currency_convert(cl.amount, cl.c_currency_id, cb.c_currency_id, c.statementdate, NULL, c.ad_client_id, c.ad_org_id) AS convertedamt, cl.c_debt_payment_id, cl.c_charge_id
-FROM c_cash c, c_cashline cl, c_cashbook cb
-WHERE c.c_cash_id = cl.c_cash_id AND c.c_cashbook_id = cb.c_cashbook_id]]></view>
+    <view name="C_CASH_DETAIL"><![CDATA[SELECT cl.c_cash_id, cl.c_cashline_id, c.ad_client_id, c.ad_org_id,  cl.isactive, cl.created, cl.createdby, cl.updated, cl.updatedby,  c.c_cashbook_id, c.name, c.statementdate, c.dateacct, c.processed, c.posted,  cl.line, cl.description, cl.cashtype, cl.c_currency_id, cl.amount,  c_currency_convert(cl.amount, cl.c_currency_id, cb.c_currency_id, c.statementdate, NULL, c.ad_client_id, c.ad_org_id) AS convertedamt,  cl.c_debt_payment_id, cl.c_charge_id FROM c_cash c, c_cashline cl, c_cashbook cb WHERE c.c_cash_id = cl.c_cash_id AND c.c_cashbook_id = cb.c_cashbook_id]]></view>
   </database>
--- a/src-db/database/model/views/C_DEBT_PAYMENT_CANCEL.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_DEBT_PAYMENT_CANCEL.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_DEBT_PAYMENT_CANCEL">
-    <view name="C_DEBT_PAYMENT_CANCEL"><![CDATA[SELECT c_debt_payment.c_debt_payment_id, c_debt_payment.ad_client_id, c_debt_payment.ad_org_id, c_debt_payment.isactive, c_debt_payment.created, c_debt_payment.createdby, c_debt_payment.updated, c_debt_payment.updatedby, c_debt_payment.isreceipt, c_debt_payment.c_settlement_cancel_id AS c_settlement_id, c_debt_payment.description, c_debt_payment.c_invoice_id, c_debt_payment.c_bpartner_id, c_debt_payment.c_currency_id, c_debt_payment.c_cashline_id, c_debt_payment.c_bankstatementline_id, c_debt_payment.c_bankaccount_id, c_debt_payment.c_cashbook_id, c_debt_payment.paymentrule, c_debt_payment.ispaid, c_debt_payment.amount, c_debt_payment.writeoffamt, c_debt_payment.dateplanned, c_debt_payment.ismanual, c_debt_payment.isvalid, c_debt_payment.changesettlementcancel, c_debt_payment.cancel_processed, c_debt_payment.status, c_debt_payment.c_withholding_id, c_debt_payment.withholdingamount, c_debt_payment.c_settlement_generate_id
-FROM c_debt_payment
-WHERE c_debt_payment.c_settlement_cancel_id IS NOT NULL]]></view>
+    <view name="C_DEBT_PAYMENT_CANCEL"><![CDATA[SELECT c_debt_payment.c_debt_payment_id, c_debt_payment.ad_client_id,  c_debt_payment.ad_org_id, c_debt_payment.isactive, c_debt_payment.created,  c_debt_payment.createdby, c_debt_payment.updated, c_debt_payment.updatedby,  c_debt_payment.isreceipt,  c_debt_payment.c_settlement_cancel_id AS c_settlement_id,  c_debt_payment.description, c_debt_payment.c_invoice_id,  c_debt_payment.c_bpartner_id, c_debt_payment.c_currency_id,  c_debt_payment.c_cashline_id, c_debt_payment.c_bankstatementline_id,  c_debt_payment.c_bankaccount_id, c_debt_payment.c_cashbook_id,  c_debt_payment.paymentrule, c_debt_payment.ispaid, c_debt_payment.amount,  c_debt_payment.writeoffamt, c_debt_payment.dateplanned,  c_debt_payment.ismanual, c_debt_payment.isvalid,  c_debt_payment.changesettlementcancel, c_debt_payment.cancel_processed,  c_debt_payment.status, c_debt_payment.c_withholding_id,  c_debt_payment.withholdingamount, c_debt_payment.c_settlement_generate_id FROM c_debt_payment WHERE c_debt_payment.c_settlement_cancel_id IS NOT NULL]]></view>
   </database>
--- a/src-db/database/model/views/C_DEBT_PAYMENT_GENERATE.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_DEBT_PAYMENT_GENERATE.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_DEBT_PAYMENT_GENERATE">
-    <view name="C_DEBT_PAYMENT_GENERATE"><![CDATA[SELECT c_debt_payment.c_debt_payment_id, c_debt_payment.ad_client_id, c_debt_payment.ad_org_id, c_debt_payment.isactive, c_debt_payment.created, c_debt_payment.createdby, c_debt_payment.updated, c_debt_payment.updatedby, c_debt_payment.isreceipt, c_debt_payment.c_settlement_generate_id AS c_settlement_id, c_debt_payment.description, c_debt_payment.c_invoice_id, c_debt_payment.c_bpartner_id, c_debt_payment.c_currency_id, c_debt_payment.c_cashline_id, c_debt_payment.c_bankstatementline_id, c_debt_payment.c_bankaccount_id, c_debt_payment.c_cashbook_id, c_debt_payment.paymentrule, c_debt_payment.ispaid, c_debt_payment.amount, c_debt_payment.writeoffamt, c_debt_payment.dateplanned, c_debt_payment.ismanual, c_debt_payment.isvalid, c_debt_payment.generate_processed, c_debt_payment.glitemamt, c_debt_payment.c_settlement_cancel_id, c_debt_payment.c_glitem_id, c_debt_payment.isdirectposting, c_debt_payment.status_initial AS status, c_debt_payment.c_project_id, c_debt_payment.c_withholding_id, c_debt_payment.withholdingamount
-FROM c_debt_payment
-WHERE c_debt_payment.c_settlement_generate_id IS NOT NULL]]></view>
+    <view name="C_DEBT_PAYMENT_GENERATE"><![CDATA[SELECT c_debt_payment.c_debt_payment_id, c_debt_payment.ad_client_id,  c_debt_payment.ad_org_id, c_debt_payment.isactive, c_debt_payment.created,  c_debt_payment.createdby, c_debt_payment.updated, c_debt_payment.updatedby,  c_debt_payment.isreceipt,  c_debt_payment.c_settlement_generate_id AS c_settlement_id,  c_debt_payment.description, c_debt_payment.c_invoice_id,  c_debt_payment.c_bpartner_id, c_debt_payment.c_currency_id,  c_debt_payment.c_cashline_id, c_debt_payment.c_bankstatementline_id,  c_debt_payment.c_bankaccount_id, c_debt_payment.c_cashbook_id,  c_debt_payment.paymentrule, c_debt_payment.ispaid, c_debt_payment.amount,  c_debt_payment.writeoffamt, c_debt_payment.dateplanned,  c_debt_payment.ismanual, c_debt_payment.isvalid,  c_debt_payment.generate_processed, c_debt_payment.glitemamt,  c_debt_payment.c_settlement_cancel_id, c_debt_payment.c_glitem_id,  c_debt_payment.isdirectposting, c_debt_payment.status_initial AS status,  c_debt_payment.c_project_id, c_debt_payment.c_withholding_id,  c_debt_payment.withholdingamount FROM c_debt_payment WHERE c_debt_payment.c_settlement_generate_id IS NOT NULL]]></view>
   </database>
--- a/src-db/database/model/views/C_DEBT_PAYMENT_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_DEBT_PAYMENT_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,24 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_DEBT_PAYMENT_V">
-    <view name="C_DEBT_PAYMENT_V"><![CDATA[SELECT c_debt_payment.c_debt_payment_id, c_debt_payment.ad_client_id, c_debt_payment.ad_org_id, c_debt_payment.isactive, c_debt_payment.created, c_debt_payment.createdby, c_debt_payment.updated, c_debt_payment.updatedby, c_debt_payment.isreceipt, c_debt_payment.c_settlement_cancel_id, c_debt_payment.c_settlement_generate_id, c_debt_payment.description, c_debt_payment.c_invoice_id, c_debt_payment.c_bpartner_id, c_debt_payment.c_currency_id, c_debt_payment.c_cashline_id, c_debt_payment.c_bankaccount_id, c_debt_payment.c_cashbook_id, c_debt_payment.paymentrule, c_debt_payment.ispaid, c_debt_payment.dateplanned, c_debt_payment.ismanual, c_debt_payment.isvalid, c_debt_payment.c_bankstatementline_id, c_debt_payment.changesettlementcancel, c_debt_payment.cancel_processed, c_debt_payment.generate_processed, c_debt_payment.c_withholding_id, c_debt_payment.withholdingamount, 
-CASE c_debt_payment.isreceipt
-WHEN 'Y' THEN c_debt_payment.amount
-ELSE c_debt_payment.amount * (-1)
-END AS amount, 
-CASE c_debt_payment.isreceipt
-WHEN 'Y' THEN c_debt_payment.writeoffamt
-ELSE c_debt_payment.writeoffamt * (-1)
-END AS writeoffamt, 
-CASE c_debt_payment.isreceipt
-WHEN 'Y' THEN 1
-ELSE (-1)
-END AS multiplierap, 
-CASE
-WHEN c_debt_payment.c_invoice_id IS NOT NULL THEN c_invoice.dateinvoiced
-WHEN c_debt_payment.c_settlement_generate_id IS NOT NULL THEN c_settlement.datetrx
-ELSE to_date(now())
-END AS docdate, c_debt_payment.glitemamt, c_debt_payment.c_order_id, c_debt_payment.status
-FROM c_debt_payment
-LEFT JOIN c_invoice ON c_debt_payment.c_invoice_id = c_invoice.c_invoice_id
-LEFT JOIN c_settlement ON c_debt_payment.c_settlement_generate_id = c_settlement.c_settlement_id]]></view>
+    <view name="C_DEBT_PAYMENT_V"><![CDATA[SELECT c_debt_payment.c_debt_payment_id, c_debt_payment.ad_client_id,  c_debt_payment.ad_org_id, c_debt_payment.isactive, c_debt_payment.created,  c_debt_payment.createdby, c_debt_payment.updated, c_debt_payment.updatedby,  c_debt_payment.isreceipt, c_debt_payment.c_settlement_cancel_id,  c_debt_payment.c_settlement_generate_id, c_debt_payment.description,  c_debt_payment.c_invoice_id, c_debt_payment.c_bpartner_id,  c_debt_payment.c_currency_id, c_debt_payment.c_cashline_id,  c_debt_payment.c_bankaccount_id, c_debt_payment.c_cashbook_id,  c_debt_payment.paymentrule, c_debt_payment.ispaid,  c_debt_payment.dateplanned, c_debt_payment.ismanual, c_debt_payment.isvalid,  c_debt_payment.c_bankstatementline_id,  c_debt_payment.changesettlementcancel, c_debt_payment.cancel_processed,  c_debt_payment.generate_processed, c_debt_payment.c_withholding_id,  c_debt_payment.withholdingamount,  CASE c_debt_payment.isreceipt WHEN 'Y' THEN c_debt_payment.amount ELSE c_debt_payment.amount * (-1) END AS amount,  CASE c_debt_payment.isreceipt WHEN 'Y' THEN c_debt_payment.writeoffamt ELSE c_debt_payment.writeoffamt * (-1) END AS writeoffamt,  CASE c_debt_payment.isreceipt WHEN 'Y' THEN 1 ELSE (-1) END AS multiplierap,  CASE WHEN c_debt_payment.c_invoice_id IS NOT NULL THEN c_invoice.dateinvoiced WHEN c_debt_payment.c_settlement_generate_id IS NOT NULL THEN c_settlement.datetrx ELSE to_date(now()) END AS docdate,  c_debt_payment.glitemamt, c_debt_payment.c_order_id, c_debt_payment.status FROM c_debt_payment LEFT JOIN c_invoice ON c_debt_payment.c_invoice_id = c_invoice.c_invoice_id LEFT JOIN c_settlement ON c_debt_payment.c_settlement_generate_id = c_settlement.c_settlement_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICELINE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICELINE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,14 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICELINE_V">
-    <view name="C_INVOICELINE_V"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_invoiceline_id, i.c_invoice_id, i.salesrep_id, i.c_bpartner_id, il.m_product_id, i.documentno, i.dateinvoiced, i.dateacct, i.issotrx, i.docstatus, round(i.multiplier * il.linenetamt, 2) AS linenetamt, round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt, 
-CASE
-WHEN il.pricelimit IS NULL THEN round(i.multiplier * il.linenetamt, 2)
-ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2)
-END AS linelimitamt, round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt, 
-CASE
-WHEN il.pricelimit IS NULL THEN 0
-ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2)
-END AS lineoverlimitamt, il.qtyinvoiced, il.line, il.c_orderline_id, il.c_uom_id
-FROM c_invoice_v i, c_invoiceline il
-WHERE i.c_invoice_id = il.c_invoice_id]]></view>
+    <view name="C_INVOICELINE_V"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_invoiceline_id, i.c_invoice_id,  i.salesrep_id, i.c_bpartner_id, il.m_product_id, i.documentno,  i.dateinvoiced, i.dateacct, i.issotrx, i.docstatus,  round(i.multiplier * il.linenetamt, 2) AS linenetamt,  round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt,  CASE WHEN il.pricelimit IS NULL THEN round(i.multiplier * il.linenetamt, 2) ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2) END AS linelimitamt,  round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt,  CASE WHEN il.pricelimit IS NULL THEN 0 ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2) END AS lineoverlimitamt,  il.qtyinvoiced, il.line, il.c_orderline_id, il.c_uom_id FROM c_invoice_v i, c_invoiceline il WHERE i.c_invoice_id = il.c_invoice_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICELINE_V2.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICELINE_V2.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,23 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICELINE_V2">
-    <view name="C_INVOICELINE_V2"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_invoiceline_id, i.c_invoice_id, i.salesrep_id, i.c_bpartner_id, i.c_bp_group_id, il.m_product_id, p.m_product_category_id, i.dateinvoiced, i.dateacct, il.qtyinvoiced * i.multiplier AS qtyinvoiced, il.pricelist, il.priceactual, il.pricelimit, 
-CASE il.pricelist
-WHEN 0 THEN 0
-ELSE round((il.pricelist - il.priceactual) / il.pricelist * 100, 2)
-END AS discount, 
-CASE il.pricelimit
-WHEN 0 THEN 0
-ELSE round((il.priceactual - il.pricelimit) / il.pricelimit * 100, 2)
-END AS margin, round(i.multiplier * il.linenetamt, 2) AS linenetamt, round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt, 
-CASE
-WHEN il.pricelimit IS NULL THEN round(i.multiplier * il.linenetamt, 2)
-ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2)
-END AS linelimitamt, round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt, 
-CASE
-WHEN il.pricelimit IS NULL THEN 0
-ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2)
-END AS lineoverlimitamt, il.account_id
-FROM c_invoice_v2 i, c_invoiceline il
-LEFT JOIN m_product p ON il.m_product_id = p.m_product_id
-WHERE i.c_invoice_id = il.c_invoice_id]]></view>
+    <view name="C_INVOICELINE_V2"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_invoiceline_id, i.c_invoice_id,  i.salesrep_id, i.c_bpartner_id, i.c_bp_group_id, il.m_product_id,  p.m_product_category_id, i.dateinvoiced, i.dateacct,  il.qtyinvoiced * i.multiplier AS qtyinvoiced, il.pricelist,  il.priceactual, il.pricelimit,  CASE il.pricelist WHEN 0 THEN 0 ELSE round((il.pricelist - il.priceactual) / il.pricelist * 100, 2) END AS discount,  CASE il.pricelimit WHEN 0 THEN 0 ELSE round((il.priceactual - il.pricelimit) / il.pricelimit * 100, 2) END AS margin,  round(i.multiplier * il.linenetamt, 2) AS linenetamt,  round(i.multiplier * il.pricelist * il.qtyinvoiced, 2) AS linelistamt,  CASE WHEN il.pricelimit IS NULL THEN round(i.multiplier * il.linenetamt, 2) ELSE round(i.multiplier * il.pricelimit * il.qtyinvoiced, 2) END AS linelimitamt,  round(i.multiplier * il.pricelist * il.qtyinvoiced - il.linenetamt, 2) AS linediscountamt,  CASE WHEN il.pricelimit IS NULL THEN 0 ELSE round(i.multiplier * il.linenetamt - il.pricelimit * il.qtyinvoiced, 2) END AS lineoverlimitamt,  il.account_id FROM c_invoice_v2 i,  c_invoiceline il LEFT JOIN m_product p ON il.m_product_id = p.m_product_id WHERE i.c_invoice_id = il.c_invoice_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_CANDIDATE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_CANDIDATE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,19 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_CANDIDATE_V">
-    <view name="C_INVOICE_CANDIDATE_V"><![CDATA[SELECT sq.ad_client_id, sq.ad_org_id, sq.c_bpartner_id, sq.c_order_id, sq.documentno, sq.dateordered, sq.c_doctype_id, sq.amountlines, sq.amountlinesgross, sq.notinvoicedlines, round(sq.notinvoicedlinesgross, c.stdprecision) AS notinvoicedlinesgross, sq.term, sq.pendinglines, round(sq.pendinglinesgross, c.stdprecision) AS pendinglinesgross, sq.qtyordered, sq.qtydelivered
-FROM (SELECT o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines AS amountlines, o.grandtotal AS amountlinesgross, sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c.stdprecision)) AS notinvoicedlines, sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c.stdprecision) * (1 + t.rate / 100)) AS notinvoicedlinesgross, o.invoicerule AS term, sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c.stdprecision)) AS pendinglines, sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c.stdprecision) * (1 + t.rate / 100)) AS pendinglinesgross, sum(l.qtyordered) AS qtyordered, sum(l.qtydelivered) AS qtydelivered, o.m_pricelist_id, c.c_currency_id
-FROM c_order o
-JOIN m_pricelist p ON o.m_pricelist_id = p.m_pricelist_id
-JOIN c_currency c ON p.c_currency_id = c.c_currency_id
-JOIN c_orderline l ON o.c_order_id = l.c_order_id
-JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id
-JOIN c_tax t ON t.c_tax_id = l.c_tax_id
-LEFT JOIN c_invoiceschedule si ON bp.c_invoiceschedule_id = si.c_invoiceschedule_id
-WHERE (o.docstatus IN ('CO', 'CL', 'IP')) AND (o.c_doctype_id IN (SELECT c_doctype.c_doctype_id
-FROM c_doctype
-WHERE c_doctype.docbasetype = 'SOO' AND (c_doctype.docsubtypeso NOT IN ('ON', 'OB', 'WR')))) AND (o.invoicerule = 'I' OR o.invoicerule = 'O' OR o.invoicerule = 'N' OR o.invoicerule = 'D' OR o.invoicerule = 'S' AND (si.invoicefrequency IS NULL OR si.invoicefrequency = 'D' OR si.invoicefrequency = 'W' OR si.invoicefrequency = 'T' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1) OR trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff + 14) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday + 14) OR si.invoicefrequency = 'M' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1)))
-GROUP BY o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines, o.grandtotal, l.c_tax_id, o.invoicerule, o.m_pricelist_id, c.c_currency_id
-HAVING sum(l.qtyordered - l.qtyinvoiced) <> 0 OR sum(l.qtydelivered - l.qtyinvoiced) <> 0) sq
-JOIN m_pricelist p ON sq.m_pricelist_id = p.m_pricelist_id
-JOIN c_currency c ON sq.c_currency_id = c.c_currency_id]]></view>
+    <view name="C_INVOICE_CANDIDATE_V"><![CDATA[SELECT sq.ad_client_id, sq.ad_org_id, sq.c_bpartner_id, sq.c_order_id,  sq.documentno, sq.dateordered, sq.c_doctype_id, sq.amountlines,  sq.amountlinesgross, sq.notinvoicedlines,  round(sq.notinvoicedlinesgross, c.stdprecision) AS notinvoicedlinesgross,  sq.term, sq.pendinglines,  round(sq.pendinglinesgross, c.stdprecision) AS pendinglinesgross,  sq.qtyordered, sq.qtydelivered FROM (SELECT o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id,  o.documentno, o.dateordered, o.c_doctype_id,  o.totallines AS amountlines, o.grandtotal AS amountlinesgross,  sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c.stdprecision)) AS notinvoicedlines,  sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c.stdprecision) * (1 + t.rate / 100)) AS notinvoicedlinesgross,  o.invoicerule AS term,  sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c.stdprecision)) AS pendinglines,  sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c.stdprecision) * (1 + t.rate / 100)) AS pendinglinesgross,  sum(l.qtyordered) AS qtyordered,  sum(l.qtydelivered) AS qtydelivered, o.m_pricelist_id,  c.c_currency_id FROM c_order o JOIN m_pricelist p ON o.m_pricelist_id = p.m_pricelist_id JOIN c_currency c ON p.c_currency_id = c.c_currency_id JOIN c_orderline l ON o.c_order_id = l.c_order_id JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id JOIN c_tax t ON t.c_tax_id = l.c_tax_id LEFT JOIN c_invoiceschedule si ON bp.c_invoiceschedule_id = si.c_invoiceschedule_id WHERE (o.docstatus IN ('CO', 'CL', 'IP')) AND (o.c_doctype_id IN (SELECT c_doctype.c_doctype_id FROM c_doctype WHERE c_doctype.docbasetype = 'SOO' AND (c_doctype.docsubtypeso NOT IN ('ON', 'OB', 'WR')))) AND (o.invoicerule = 'I' OR o.invoicerule = 'O' OR o.invoicerule = 'N' OR o.invoicerule = 'D' OR o.invoicerule = 'S' AND (si.invoicefrequency IS NULL OR si.invoicefrequency = 'D' OR si.invoicefrequency = 'W' OR si.invoicefrequency = 'T' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1) OR trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff + 14) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday + 14) OR si.invoicefrequency = 'M' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1))) GROUP BY o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines, o.grandtotal, l.c_tax_id, o.invoicerule, o.m_pricelist_id, c.c_currency_id HAVING sum(l.qtyordered - l.qtyinvoiced) <> 0 OR sum(l.qtydelivered - l.qtyinvoiced) <> 0) sq JOIN m_pricelist p ON sq.m_pricelist_id = p.m_pricelist_id JOIN c_currency c ON sq.c_currency_id = c.c_currency_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_CUSTOMERPRODQTR.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_CUSTOMERPRODQTR.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,14 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_CUSTOMERPRODQTR">
-    <view name="C_INVOICE_CUSTOMERPRODQTR"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_bpartner_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'Q') AS dateinvoiced, sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt, sum(il.linelimitamt) AS linelimitamt, sum(il.linediscountamt) AS linediscountamt, 
-CASE sum(il.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2)
-END AS linediscount, sum(il.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(il.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2)
-END AS lineoverlimit, sum(il.qtyinvoiced) AS qtyinvoiced
-FROM c_invoiceline_v2 il
-GROUP BY il.ad_client_id, il.ad_org_id, il.c_bpartner_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'Q')]]></view>
+    <view name="C_INVOICE_CUSTOMERPRODQTR"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_bpartner_id,  il.m_product_category_id,  TRUNC(il.dateinvoiced, 'Q') AS dateinvoiced,  sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt,  sum(il.linelimitamt) AS linelimitamt,  sum(il.linediscountamt) AS linediscountamt,  CASE sum(il.linelistamt) WHEN 0 THEN 0 ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2) END AS linediscount,  sum(il.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(il.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2) END AS lineoverlimit,  sum(il.qtyinvoiced) AS qtyinvoiced FROM c_invoiceline_v2 il GROUP BY il.ad_client_id, il.ad_org_id, il.c_bpartner_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'Q')]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_CUSTOMERVENDQTR.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_CUSTOMERVENDQTR.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,15 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_CUSTOMERVENDQTR">
-    <view name="C_INVOICE_CUSTOMERVENDQTR"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_bpartner_id, po.c_bpartner_id AS vendor_id, TRUNC(il.dateinvoiced, 'Q') AS dateinvoiced, sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt, sum(il.linelimitamt) AS linelimitamt, sum(il.linediscountamt) AS linediscountamt, 
-CASE sum(il.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2)
-END AS linediscount, sum(il.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(il.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2)
-END AS lineoverlimit, sum(il.qtyinvoiced) AS qtyinvoiced
-FROM c_invoiceline_v2 il, m_product_po po
-WHERE il.m_product_id = po.m_product_id
-GROUP BY il.ad_client_id, il.ad_org_id, il.c_bpartner_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'Q')]]></view>
+    <view name="C_INVOICE_CUSTOMERVENDQTR"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.c_bpartner_id,  po.c_bpartner_id AS vendor_id,  TRUNC(il.dateinvoiced, 'Q') AS dateinvoiced,  sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt,  sum(il.linelimitamt) AS linelimitamt,  sum(il.linediscountamt) AS linediscountamt,  CASE sum(il.linelistamt) WHEN 0 THEN 0 ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2) END AS linediscount,  sum(il.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(il.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2) END AS lineoverlimit,  sum(il.qtyinvoiced) AS qtyinvoiced FROM c_invoiceline_v2 il, m_product_po po WHERE il.m_product_id = po.m_product_id GROUP BY il.ad_client_id, il.ad_org_id, il.c_bpartner_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'Q')]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_DAY.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_DAY.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,14 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_DAY">
-    <view name="C_INVOICE_DAY"><![CDATA[SELECT c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DD') AS dateinvoiced, sum(c_invoiceline_v2.linenetamt) AS linenetamt, sum(c_invoiceline_v2.linelistamt) AS linelistamt, sum(c_invoiceline_v2.linelimitamt) AS linelimitamt, sum(c_invoiceline_v2.linediscountamt) AS linediscountamt, 
-CASE sum(c_invoiceline_v2.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2)
-END AS linediscount, sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(c_invoiceline_v2.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2)
-END AS lineoverlimit
-FROM c_invoiceline_v2
-GROUP BY c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DD')]]></view>
+    <view name="C_INVOICE_DAY"><![CDATA[SELECT c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id,  c_invoiceline_v2.salesrep_id,  TRUNC(c_invoiceline_v2.dateinvoiced, 'DD') AS dateinvoiced,  sum(c_invoiceline_v2.linenetamt) AS linenetamt,  sum(c_invoiceline_v2.linelistamt) AS linelistamt,  sum(c_invoiceline_v2.linelimitamt) AS linelimitamt,  sum(c_invoiceline_v2.linediscountamt) AS linediscountamt,  CASE sum(c_invoiceline_v2.linelistamt) WHEN 0 THEN 0 ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2) END AS linediscount,  sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(c_invoiceline_v2.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2) END AS lineoverlimit FROM c_invoiceline_v2 GROUP BY c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DD')]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_HEADER_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_HEADER_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,15 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_HEADER_V">
-    <view name="C_INVOICE_HEADER_V"><![CDATA[SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, to_char('en_US') AS ad_language, i.c_invoice_id, i.issotrx, i.documentno, i.docstatus, i.c_doctype_id, i.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid, dt.printname AS documenttype, dt.documentnote AS documenttypenote, i.c_order_id, i.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, i.dateinvoiced, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, i.description, i.poreference, i.dateordered, i.c_currency_id, pt.name AS paymentterm, pt.documentnote AS paymenttermnote, i.c_charge_id, i.chargeamt, i.totallines, i.grandtotal, i.m_pricelist_id, i.istaxincluded, i.c_campaign_id, i.c_project_id, i.c_activity_id
-FROM c_invoice i
-JOIN c_doctype dt ON i.c_doctype_id = dt.c_doctype_id
-JOIN c_paymentterm pt ON i.c_paymentterm_id = pt.c_paymentterm_id
-JOIN c_bpartner bp ON i.c_bpartner_id = bp.c_bpartner_id
-LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id
-JOIN c_bpartner_location bpl ON i.c_bpartner_location_id = bpl.c_bpartner_location_id
-LEFT JOIN ad_user bpc ON i.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id
-JOIN ad_orginfo oi ON i.ad_org_id = oi.ad_org_id
-LEFT JOIN ad_user u ON i.salesrep_id = u.ad_user_id
-LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
+    <view name="C_INVOICE_HEADER_V"><![CDATA[SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby,  i.updated, i.updatedby, to_char('en_US') AS ad_language,  i.c_invoice_id, i.issotrx, i.documentno, i.docstatus, i.c_doctype_id,  i.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id,  oi.taxid, dt.printname AS documenttype, dt.documentnote AS documenttypenote,  i.c_order_id, i.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name,  i.dateinvoiced, bpg.name AS bpgreeting, bp.name, bp.name2,  bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, i.description, i.poreference, i.dateordered,  i.c_currency_id, pt.name AS paymentterm, pt.documentnote AS paymenttermnote,  i.c_charge_id, i.chargeamt, i.totallines, i.grandtotal, i.m_pricelist_id,  i.istaxincluded, i.c_campaign_id, i.c_project_id, i.c_activity_id FROM c_invoice i JOIN c_doctype dt ON i.c_doctype_id = dt.c_doctype_id JOIN c_paymentterm pt ON i.c_paymentterm_id = pt.c_paymentterm_id JOIN c_bpartner bp ON i.c_bpartner_id = bp.c_bpartner_id LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id JOIN c_bpartner_location bpl ON i.c_bpartner_location_id = bpl.c_bpartner_location_id LEFT JOIN ad_user bpc ON i.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id JOIN ad_orginfo oi ON i.ad_org_id = oi.ad_org_id LEFT JOIN ad_user u ON i.salesrep_id = u.ad_user_id LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_HEADER_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_HEADER_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,15 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_HEADER_VT">
-    <view name="C_INVOICE_HEADER_VT"><![CDATA[SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, dt.ad_language, i.c_invoice_id, i.issotrx, i.documentno, i.docstatus, i.c_doctype_id, i.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid, dt.printname AS documenttype, dt.documentnote AS documenttypenote, i.c_order_id, i.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, i.dateinvoiced, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, i.description, i.poreference, i.dateordered, i.c_currency_id, pt.name AS paymentterm, pt.documentnote AS paymenttermnote, i.c_charge_id, i.chargeamt, i.totallines, i.grandtotal, i.m_pricelist_id, i.istaxincluded, i.c_campaign_id, i.c_project_id, i.c_activity_id
-FROM c_invoice i
-JOIN c_doctype_trl dt ON i.c_doctype_id = dt.c_doctype_id
-JOIN c_paymentterm_trl pt ON i.c_paymentterm_id = pt.c_paymentterm_id AND dt.ad_language = pt.ad_language
-JOIN c_bpartner bp ON i.c_bpartner_id = bp.c_bpartner_id
-LEFT JOIN c_greeting_trl bpg ON bp.c_greeting_id = bpg.c_greeting_id AND dt.ad_language = bpg.ad_language
-JOIN c_bpartner_location bpl ON i.c_bpartner_location_id = bpl.c_bpartner_location_id
-LEFT JOIN ad_user bpc ON i.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting_trl bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id AND dt.ad_language = bpcg.ad_language
-JOIN ad_orginfo oi ON i.ad_org_id = oi.ad_org_id
-LEFT JOIN ad_user u ON i.salesrep_id = u.ad_user_id
-LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
+    <view name="C_INVOICE_HEADER_VT"><![CDATA[SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby,  i.updated, i.updatedby, dt.ad_language, i.c_invoice_id, i.issotrx,  i.documentno, i.docstatus, i.c_doctype_id, i.c_bpartner_id,  bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid,  dt.printname AS documenttype, dt.documentnote AS documenttypenote,  i.c_order_id, i.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name,  i.dateinvoiced, bpg.name AS bpgreeting, bp.name, bp.name2,  bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, i.description, i.poreference, i.dateordered,  i.c_currency_id, pt.name AS paymentterm, pt.documentnote AS paymenttermnote,  i.c_charge_id, i.chargeamt, i.totallines, i.grandtotal, i.m_pricelist_id,  i.istaxincluded, i.c_campaign_id, i.c_project_id, i.c_activity_id FROM c_invoice i JOIN c_doctype_trl dt ON i.c_doctype_id = dt.c_doctype_id JOIN c_paymentterm_trl pt ON i.c_paymentterm_id = pt.c_paymentterm_id AND dt.ad_language = pt.ad_language JOIN c_bpartner bp ON i.c_bpartner_id = bp.c_bpartner_id LEFT JOIN c_greeting_trl bpg ON bp.c_greeting_id = bpg.c_greeting_id AND dt.ad_language = bpg.ad_language JOIN c_bpartner_location bpl ON i.c_bpartner_location_id = bpl.c_bpartner_location_id LEFT JOIN ad_user bpc ON i.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting_trl bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id AND dt.ad_language = bpcg.ad_language JOIN ad_orginfo oi ON i.ad_org_id = oi.ad_org_id LEFT JOIN ad_user u ON i.salesrep_id = u.ad_user_id LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_LINETAX_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_LINETAX_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,55 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_LINETAX_V">
-    <view name="C_INVOICE_LINETAX_V"><![CDATA[(((SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, 'en_US' AS ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line, 
-CASE
-WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced
-ELSE NULL
-END AS qtyinvoiced, 
-CASE
-WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN uom.uomsymbol
-ELSE NULL
-END AS uomsymbol, COALESCE(p.name, il.description) AS name, 
-CASE
-WHEN p.name IS NOT NULL THEN il.description
-ELSE NULL
-END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, ra.description AS resourcedescription, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND (il.pricelist <> 0 OR il.m_product_id IS NOT NULL) THEN il.pricelist
-ELSE NULL
-END AS pricelist, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND il.pricelist > il.priceactual THEN (il.pricelist - il.priceactual) / il.pricelist * 100
-ELSE NULL
-END AS discount, 
-CASE
-WHEN il.priceactual <> 0 OR il.m_product_id IS NOT NULL THEN il.priceactual
-ELSE NULL
-END AS priceactual, 
-CASE
-WHEN il.linenetamt <> 0 OR il.m_product_id IS NOT NULL THEN il.linenetamt
-ELSE NULL
-END AS linenetamt
-FROM c_invoiceline il
-JOIN c_uom uom ON il.c_uom_id = uom.c_uom_id
-JOIN c_invoice i ON il.c_invoice_id = i.c_invoice_id
-LEFT JOIN m_product p ON il.m_product_id = p.m_product_id
-LEFT JOIN s_resourceassignment ra ON il.s_resourceassignment_id = ra.s_resourceassignment_id
-UNION 
-SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, 'en_US' AS ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line + b.line / 100 AS line, il.qtyinvoiced * b.bomqty AS qtyinvoiced, uom.uomsymbol, p.name, b.description, p.documentnote, p.upc, p.sku, p.value AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM m_product_bom b
-JOIN c_invoiceline il ON b.m_product_id = il.m_product_id
-JOIN m_product bp ON bp.m_product_id = il.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y'
-JOIN m_product p ON b.m_productbom_id = p.m_product_id
-JOIN c_uom uom ON p.c_uom_id = uom.c_uom_id)
-UNION 
-SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, 'en_US' AS ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line, NULL AS qtyinvoiced, NULL AS uomsymbol, il.description AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_invoiceline il
-WHERE il.c_uom_id IS NULL)
-UNION 
-SELECT c_invoice.ad_client_id, c_invoice.ad_org_id, c_invoice.isactive, c_invoice.created, c_invoice.createdby, c_invoice.updated, c_invoice.updatedby, 'en_US' AS ad_language, c_invoice.c_invoice_id, NULL AS c_invoiceline_id, NULL AS c_tax_id, 9998 AS line, NULL AS qtyinvoiced, NULL AS uomsymbol, NULL AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_invoice)
-UNION 
-SELECT it.ad_client_id, it.ad_org_id, it.isactive, it.created, it.createdby, it.updated, it.updatedby, 'en_US' AS ad_language, it.c_invoice_id, NULL AS c_invoiceline_id, it.c_tax_id, 9999 AS line, NULL AS qtyinvoiced, NULL AS uomsymbol, t.name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, it.taxbaseamt AS priceactual, it.taxamt AS linenetamt
-FROM c_invoicetax it
-JOIN c_tax t ON it.c_tax_id = t.c_tax_id]]></view>
+    <view name="C_INVOICE_LINETAX_V"><![CDATA[(((SELECT il.ad_client_id, il.ad_org_id,  il.isactive, il.created, il.createdby,  il.updated, il.updatedby,  'en_US' AS ad_language,  il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id, il.line,  CASE WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced ELSE NULL END AS qtyinvoiced,  CASE WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN uom.uomsymbol ELSE NULL END AS uomsymbol,  COALESCE(p.name, il.description) AS name,  CASE WHEN p.name IS NOT NULL THEN il.description ELSE NULL END AS description,  p.documentnote, p.upc, p.sku,  p.value AS productvalue,  ra.description AS resourcedescription,  CASE WHEN i.isdiscountprinted = 'Y' AND (il.pricelist <> 0 OR il.m_product_id IS NOT NULL) THEN il.pricelist ELSE NULL END AS pricelist,  CASE WHEN i.isdiscountprinted = 'Y' AND il.pricelist > il.priceactual THEN (il.pricelist - il.priceactual) / il.pricelist * 100 ELSE NULL END AS discount,  CASE WHEN il.priceactual <> 0 OR il.m_product_id IS NOT NULL THEN il.priceactual ELSE NULL END AS priceactual,  CASE WHEN il.linenetamt <> 0 OR il.m_product_id IS NOT NULL THEN il.linenetamt ELSE NULL END AS linenetamt FROM c_invoiceline il JOIN c_uom uom ON il.c_uom_id = uom.c_uom_id JOIN c_invoice i ON il.c_invoice_id = i.c_invoice_id LEFT JOIN m_product p ON il.m_product_id = p.m_product_id LEFT JOIN s_resourceassignment ra ON il.s_resourceassignment_id = ra.s_resourceassignment_id UNION  SELECT il.ad_client_id, il.ad_org_id,  il.isactive, il.created, il.createdby,  il.updated, il.updatedby,  'en_US' AS ad_language,  il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id,  il.line + b.line / 100 AS line,  il.qtyinvoiced * b.bomqty AS qtyinvoiced,  uom.uomsymbol, p.name, b.description,  p.documentnote, p.upc, p.sku,  p.value AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM m_product_bom b JOIN c_invoiceline il ON b.m_product_id = il.m_product_id JOIN m_product bp ON bp.m_product_id = il.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y' JOIN m_product p ON b.m_productbom_id = p.m_product_id JOIN c_uom uom ON p.c_uom_id = uom.c_uom_id) UNION  SELECT il.ad_client_id, il.ad_org_id, il.isactive,  il.created, il.createdby, il.updated, il.updatedby,  'en_US' AS ad_language, il.c_invoice_id,  il.c_invoiceline_id, il.c_tax_id, il.line,  NULL AS qtyinvoiced,  NULL AS uomsymbol, il.description AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM c_invoiceline il WHERE il.c_uom_id IS NULL) UNION  SELECT c_invoice.ad_client_id, c_invoice.ad_org_id,  c_invoice.isactive, c_invoice.created, c_invoice.createdby,  c_invoice.updated, c_invoice.updatedby,  'en_US' AS ad_language, c_invoice.c_invoice_id,  NULL AS c_invoiceline_id,  NULL AS c_tax_id, 9998 AS line,  NULL AS qtyinvoiced, NULL AS uomsymbol,  NULL AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  NULL AS priceactual, NULL AS linenetamt FROM c_invoice) UNION  SELECT it.ad_client_id, it.ad_org_id, it.isactive, it.created,  it.createdby, it.updated, it.updatedby,  'en_US' AS ad_language, it.c_invoice_id,  NULL AS c_invoiceline_id, it.c_tax_id,  9999 AS line, NULL AS qtyinvoiced,  NULL AS uomsymbol, t.name,  NULL AS description,  NULL AS documentnote,  NULL AS upc, NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  it.taxbaseamt AS priceactual, it.taxamt AS linenetamt FROM c_invoicetax it JOIN c_tax t ON it.c_tax_id = t.c_tax_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_LINETAX_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_LINETAX_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,59 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_LINETAX_VT">
-    <view name="C_INVOICE_LINETAX_VT"><![CDATA[(((SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, uom.ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line, 
-CASE
-WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced
-ELSE NULL
-END AS qtyinvoiced, 
-CASE
-WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN uom.uomsymbol
-ELSE NULL
-END AS uomsymbol, COALESCE(COALESCE(pt.name, p.name), il.description) AS name, 
-CASE
-WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN il.description
-ELSE NULL
-END AS description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, ra.description AS resourcedescription, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND (il.pricelist <> 0 OR il.m_product_id IS NOT NULL) THEN il.pricelist
-ELSE NULL
-END AS pricelist, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND il.pricelist > il.priceactual THEN (il.pricelist - il.priceactual) / il.pricelist * 100
-ELSE NULL
-END AS discount, 
-CASE
-WHEN il.priceactual <> 0 OR il.m_product_id IS NOT NULL THEN il.priceactual
-ELSE NULL
-END AS priceactual, 
-CASE
-WHEN il.linenetamt <> 0 OR il.m_product_id IS NOT NULL THEN il.linenetamt
-ELSE NULL
-END AS linenetamt
-FROM c_invoiceline il
-JOIN c_uom_trl uom ON il.c_uom_id = uom.c_uom_id
-JOIN c_invoice i ON il.c_invoice_id = i.c_invoice_id
-LEFT JOIN m_product p ON il.m_product_id = p.m_product_id
-LEFT JOIN m_product_trl pt ON il.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language
-LEFT JOIN s_resourceassignment ra ON il.s_resourceassignment_id = ra.s_resourceassignment_id
-UNION 
-SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, uom.ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line + b.line / 100 AS line, il.qtyinvoiced * b.bomqty AS qtyinvoiced, uom.uomsymbol, COALESCE(pt.name, p.name) AS name, b.description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM m_product_bom b
-JOIN c_invoiceline il ON b.m_product_id = il.m_product_id
-JOIN m_product bp ON bp.m_product_id = il.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y'
-JOIN m_product p ON b.m_productbom_id = p.m_product_id
-JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id
-JOIN m_product_trl pt ON b.m_productbom_id = pt.m_product_id AND uom.ad_language = pt.ad_language)
-UNION 
-SELECT il.ad_client_id, il.ad_org_id, il.isactive, il.created, il.createdby, il.updated, il.updatedby, l.ad_language, il.c_invoice_id, il.c_invoiceline_id, il.c_tax_id, il.line, NULL AS qtyinvoiced, NULL AS uomsymbol, il.description AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_invoiceline il, ad_language l
-WHERE il.c_uom_id IS NULL AND l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y')
-UNION 
-SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, l.ad_language, i.c_invoice_id, NULL AS c_invoiceline_id, NULL AS c_tax_id, 9998 AS line, NULL AS qtyinvoiced, NULL AS uomsymbol, NULL AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_invoice i, ad_language l
-WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y')
-UNION 
-SELECT it.ad_client_id, it.ad_org_id, it.isactive, it.created, it.createdby, it.updated, it.updatedby, l.ad_language, it.c_invoice_id, NULL AS c_invoiceline_id, it.c_tax_id, 9999 AS line, NULL AS qtyinvoiced, NULL AS uomsymbol, t.name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, it.taxbaseamt AS priceactual, it.taxamt AS linenetamt
-FROM c_invoicetax it
-JOIN c_tax t ON it.c_tax_id = t.c_tax_id, ad_language l
-WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y']]></view>
+    <view name="C_INVOICE_LINETAX_VT"><![CDATA[(((SELECT il.ad_client_id, il.ad_org_id,  il.isactive, il.created, il.createdby,  il.updated, il.updatedby, uom.ad_language,  il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id, il.line,  CASE WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN il.qtyinvoiced ELSE NULL END AS qtyinvoiced,  CASE WHEN il.qtyinvoiced <> 0 OR il.m_product_id IS NOT NULL THEN uom.uomsymbol ELSE NULL END AS uomsymbol,  COALESCE(COALESCE(pt.name, p.name), il.description) AS name,  CASE WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN il.description ELSE NULL END AS description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote,  p.upc, p.sku, p.value AS productvalue,  ra.description AS resourcedescription,  CASE WHEN i.isdiscountprinted = 'Y' AND (il.pricelist <> 0 OR il.m_product_id IS NOT NULL) THEN il.pricelist ELSE NULL END AS pricelist,  CASE WHEN i.isdiscountprinted = 'Y' AND il.pricelist > il.priceactual THEN (il.pricelist - il.priceactual) / il.pricelist * 100 ELSE NULL END AS discount,  CASE WHEN il.priceactual <> 0 OR il.m_product_id IS NOT NULL THEN il.priceactual ELSE NULL END AS priceactual,  CASE WHEN il.linenetamt <> 0 OR il.m_product_id IS NOT NULL THEN il.linenetamt ELSE NULL END AS linenetamt FROM c_invoiceline il JOIN c_uom_trl uom ON il.c_uom_id = uom.c_uom_id JOIN c_invoice i ON il.c_invoice_id = i.c_invoice_id LEFT JOIN m_product p ON il.m_product_id = p.m_product_id LEFT JOIN m_product_trl pt ON il.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language LEFT JOIN s_resourceassignment ra ON il.s_resourceassignment_id = ra.s_resourceassignment_id UNION  SELECT il.ad_client_id, il.ad_org_id,  il.isactive, il.created, il.createdby,  il.updated, il.updatedby, uom.ad_language,  il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id,  il.line + b.line / 100 AS line,  il.qtyinvoiced * b.bomqty AS qtyinvoiced,  uom.uomsymbol,  COALESCE(pt.name, p.name) AS name,  b.description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote,  p.upc, p.sku, p.value AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM m_product_bom b JOIN c_invoiceline il ON b.m_product_id = il.m_product_id JOIN m_product bp ON bp.m_product_id = il.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y' JOIN m_product p ON b.m_productbom_id = p.m_product_id JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id JOIN m_product_trl pt ON b.m_productbom_id = pt.m_product_id AND uom.ad_language = pt.ad_language) UNION  SELECT il.ad_client_id, il.ad_org_id, il.isactive,  il.created, il.createdby, il.updated, il.updatedby,  l.ad_language, il.c_invoice_id, il.c_invoiceline_id,  il.c_tax_id, il.line, NULL AS qtyinvoiced,  NULL AS uomsymbol, il.description AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM c_invoiceline il, ad_language l WHERE il.c_uom_id IS NULL AND l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y') UNION  SELECT i.ad_client_id, i.ad_org_id, i.isactive, i.created,  i.createdby, i.updated, i.updatedby, l.ad_language,  i.c_invoice_id, NULL AS c_invoiceline_id,  NULL AS c_tax_id, 9998 AS line,  NULL AS qtyinvoiced, NULL AS uomsymbol,  NULL AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  NULL AS priceactual, NULL AS linenetamt FROM c_invoice i, ad_language l WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y') UNION  SELECT it.ad_client_id, it.ad_org_id, it.isactive, it.created,  it.createdby, it.updated, it.updatedby, l.ad_language,  it.c_invoice_id, NULL AS c_invoiceline_id,  it.c_tax_id, 9999 AS line, NULL AS qtyinvoiced,  NULL AS uomsymbol, t.name,  NULL AS description,  NULL AS documentnote,  NULL AS upc, NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  it.taxbaseamt AS priceactual, it.taxamt AS linenetamt FROM c_invoicetax it JOIN c_tax t ON it.c_tax_id = t.c_tax_id, ad_language l WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_MONTH.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_MONTH.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,14 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_MONTH">
-    <view name="C_INVOICE_MONTH"><![CDATA[SELECT c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'MM') AS dateinvoiced, sum(c_invoiceline_v2.linenetamt) AS linenetamt, sum(c_invoiceline_v2.linelistamt) AS linelistamt, sum(c_invoiceline_v2.linelimitamt) AS linelimitamt, sum(c_invoiceline_v2.linediscountamt) AS linediscountamt, 
-CASE sum(c_invoiceline_v2.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2)
-END AS linediscount, sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(c_invoiceline_v2.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2)
-END AS lineoverlimit
-FROM c_invoiceline_v2
-GROUP BY c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'MM')]]></view>
+    <view name="C_INVOICE_MONTH"><![CDATA[SELECT c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id,  c_invoiceline_v2.salesrep_id,  TRUNC(c_invoiceline_v2.dateinvoiced, 'MM') AS dateinvoiced,  sum(c_invoiceline_v2.linenetamt) AS linenetamt,  sum(c_invoiceline_v2.linelistamt) AS linelistamt,  sum(c_invoiceline_v2.linelimitamt) AS linelimitamt,  sum(c_invoiceline_v2.linediscountamt) AS linediscountamt,  CASE sum(c_invoiceline_v2.linelistamt) WHEN 0 THEN 0 ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2) END AS linediscount,  sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(c_invoiceline_v2.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2) END AS lineoverlimit FROM c_invoiceline_v2 GROUP BY c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'MM')]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_PRODMONTH.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_PRODMONTH.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,14 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_PRODMONTH">
-    <view name="C_INVOICE_PRODMONTH"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'MM') AS dateinvoiced, sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt, sum(il.linelimitamt) AS linelimitamt, sum(il.linediscountamt) AS linediscountamt, 
-CASE sum(il.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2)
-END AS linediscount, sum(il.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(il.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2)
-END AS lineoverlimit, sum(il.qtyinvoiced) AS qtyinvoiced
-FROM c_invoiceline_v2 il
-GROUP BY il.ad_client_id, il.ad_org_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'MM')]]></view>
+    <view name="C_INVOICE_PRODMONTH"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.m_product_category_id,  TRUNC(il.dateinvoiced, 'MM') AS dateinvoiced,  sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt,  sum(il.linelimitamt) AS linelimitamt,  sum(il.linediscountamt) AS linediscountamt,  CASE sum(il.linelistamt) WHEN 0 THEN 0 ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2) END AS linediscount,  sum(il.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(il.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2) END AS lineoverlimit,  sum(il.qtyinvoiced) AS qtyinvoiced FROM c_invoiceline_v2 il GROUP BY il.ad_client_id, il.ad_org_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'MM')]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_PRODWEEK.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_PRODWEEK.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,14 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_PRODWEEK">
-    <view name="C_INVOICE_PRODWEEK"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'DY') AS dateinvoiced, sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt, sum(il.linelimitamt) AS linelimitamt, sum(il.linediscountamt) AS linediscountamt, 
-CASE sum(il.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2)
-END AS linediscount, sum(il.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(il.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2)
-END AS lineoverlimit, sum(il.qtyinvoiced) AS qtyinvoiced
-FROM c_invoiceline_v2 il
-GROUP BY il.ad_client_id, il.ad_org_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'DY')]]></view>
+    <view name="C_INVOICE_PRODWEEK"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, il.m_product_category_id,  TRUNC(il.dateinvoiced, 'DY') AS dateinvoiced,  sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt,  sum(il.linelimitamt) AS linelimitamt,  sum(il.linediscountamt) AS linediscountamt,  CASE sum(il.linelistamt) WHEN 0 THEN 0 ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2) END AS linediscount,  sum(il.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(il.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2) END AS lineoverlimit,  sum(il.qtyinvoiced) AS qtyinvoiced FROM c_invoiceline_v2 il GROUP BY il.ad_client_id, il.ad_org_id, il.m_product_category_id, TRUNC(il.dateinvoiced, 'DY')]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,26 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_V">
-    <view name="C_INVOICE_V"><![CDATA[SELECT i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus, i.docaction, i.processing, i.processed, i.c_doctype_id, i.c_doctypetarget_id, i.c_order_id, i.description, i.salesrep_id, i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id, i.c_bpartner_location_id, i.ad_user_id, i.poreference, i.dateordered, i.c_currency_id, i.paymentrule, i.c_paymentterm_id, i.c_charge_id, i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id, i.isprinted, i.isdiscountprinted, 
-CASE
-WHEN substr(d.docbasetype, 3) = 'C' THEN i.chargeamt * (-1)
-ELSE i.chargeamt
-END AS chargeamt, 
-CASE
-WHEN substr(d.docbasetype, 3) = 'C' THEN i.totallines * (-1)
-ELSE i.totallines
-END AS totallines, 
-CASE
-WHEN substr(d.docbasetype, 3) = 'C' THEN i.grandtotal * (-1)
-ELSE i.grandtotal
-END AS grandtotal, 
-CASE
-WHEN substr(d.docbasetype, 3) = 'C' THEN (-1)
-ELSE 1
-END AS multiplier, 
-CASE
-WHEN substr(d.docbasetype, 2, 1) = 'P' THEN (-1)
-ELSE 1
-END AS multiplierap, d.docbasetype
-FROM c_invoice i
-JOIN c_doctype d ON i.c_doctype_id = d.c_doctype_id]]></view>
+    <view name="C_INVOICE_V"><![CDATA[SELECT i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created,  i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus,  i.docaction, i.processing, i.processed, i.c_doctype_id,  i.c_doctypetarget_id, i.c_order_id, i.description, i.salesrep_id,  i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id,  i.c_bpartner_location_id, i.ad_user_id, i.poreference, i.dateordered,  i.c_currency_id, i.paymentrule, i.c_paymentterm_id, i.c_charge_id,  i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id,  i.isprinted, i.isdiscountprinted,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN i.chargeamt * (-1) ELSE i.chargeamt END AS chargeamt,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN i.totallines * (-1) ELSE i.totallines END AS totallines,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN i.grandtotal * (-1) ELSE i.grandtotal END AS grandtotal,  CASE WHEN substr(d.docbasetype, 3) = 'C' THEN (-1) ELSE 1 END AS multiplier,  CASE WHEN substr(d.docbasetype, 2, 1) = 'P' THEN (-1) ELSE 1 END AS multiplierap,  d.docbasetype FROM c_invoice i JOIN c_doctype d ON i.c_doctype_id = d.c_doctype_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_V2.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_V2.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,22 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_V2">
-    <view name="C_INVOICE_V2"><![CDATA[SELECT i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created, i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus, i.docaction, i.isprinted, i.isdiscountprinted, i.processing, i.processed, i.c_doctype_id, i.c_doctypetarget_id, i.c_order_id, i.description, i.salesrep_id, i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id, i.c_bpartner_location_id, i.ad_user_id, b.c_bp_group_id, i.poreference, i.dateordered, i.c_currency_id, i.paymentrule, i.c_paymentterm_id, i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id, i.c_charge_id, 
-CASE substr(d.docbasetype, 3)
-WHEN 'C' THEN i.chargeamt * (-1)
-ELSE i.chargeamt
-END AS chargeamt, 
-CASE substr(d.docbasetype, 3)
-WHEN 'C' THEN i.totallines * (-1)
-ELSE i.totallines
-END AS totallines, 
-CASE substr(d.docbasetype, 3)
-WHEN 'C' THEN i.grandtotal * (-1)
-ELSE i.grandtotal
-END AS grandtotal, 
-CASE substr(d.docbasetype, 3)
-WHEN 'C' THEN (-1)
-ELSE 1
-END AS multiplier
-FROM c_invoice i, c_doctype d, c_bpartner b
-WHERE i.c_doctype_id = d.c_doctype_id AND i.c_bpartner_id = b.c_bpartner_id]]></view>
+    <view name="C_INVOICE_V2"><![CDATA[SELECT i.c_invoice_id, i.ad_client_id, i.ad_org_id, i.isactive, i.created,  i.createdby, i.updated, i.updatedby, i.issotrx, i.documentno, i.docstatus,  i.docaction, i.isprinted, i.isdiscountprinted, i.processing, i.processed,  i.c_doctype_id, i.c_doctypetarget_id, i.c_order_id, i.description,  i.salesrep_id, i.dateinvoiced, i.dateprinted, i.dateacct, i.c_bpartner_id,  i.c_bpartner_location_id, i.ad_user_id, b.c_bp_group_id, i.poreference,  i.dateordered, i.c_currency_id, i.paymentrule, i.c_paymentterm_id,  i.m_pricelist_id, i.c_campaign_id, i.c_project_id, i.c_activity_id,  i.c_charge_id,  CASE substr(d.docbasetype, 3) WHEN 'C' THEN i.chargeamt * (-1) ELSE i.chargeamt END AS chargeamt,  CASE substr(d.docbasetype, 3) WHEN 'C' THEN i.totallines * (-1) ELSE i.totallines END AS totallines,  CASE substr(d.docbasetype, 3) WHEN 'C' THEN i.grandtotal * (-1) ELSE i.grandtotal END AS grandtotal,  CASE substr(d.docbasetype, 3) WHEN 'C' THEN (-1) ELSE 1 END AS multiplier FROM c_invoice i, c_doctype d, c_bpartner b WHERE i.c_doctype_id = d.c_doctype_id AND i.c_bpartner_id = b.c_bpartner_id]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_VENDORMONTH.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_VENDORMONTH.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,15 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_VENDORMONTH">
-    <view name="C_INVOICE_VENDORMONTH"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'MM') AS dateinvoiced, sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt, sum(il.linelimitamt) AS linelimitamt, sum(il.linediscountamt) AS linediscountamt, 
-CASE sum(il.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2)
-END AS linediscount, sum(il.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(il.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2)
-END AS lineoverlimit, sum(il.qtyinvoiced) AS qtyinvoiced
-FROM c_invoiceline_v2 il, m_product_po po
-WHERE il.m_product_id = po.m_product_id
-GROUP BY il.ad_client_id, il.ad_org_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'MM')]]></view>
+    <view name="C_INVOICE_VENDORMONTH"><![CDATA[SELECT il.ad_client_id, il.ad_org_id, po.c_bpartner_id,  TRUNC(il.dateinvoiced, 'MM') AS dateinvoiced,  sum(il.linenetamt) AS linenetamt, sum(il.linelistamt) AS linelistamt,  sum(il.linelimitamt) AS linelimitamt,  sum(il.linediscountamt) AS linediscountamt,  CASE sum(il.linelistamt) WHEN 0 THEN 0 ELSE round((sum(il.linelistamt) - sum(il.linenetamt)) / sum(il.linelistamt) * 100, 2) END AS linediscount,  sum(il.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(il.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(il.linenetamt) - sum(il.lineoverlimitamt)) / sum(il.linenetamt) * 100, 2) END AS lineoverlimit,  sum(il.qtyinvoiced) AS qtyinvoiced FROM c_invoiceline_v2 il, m_product_po po WHERE il.m_product_id = po.m_product_id GROUP BY il.ad_client_id, il.ad_org_id, po.c_bpartner_id, TRUNC(il.dateinvoiced, 'MM')]]></view>
   </database>
--- a/src-db/database/model/views/C_INVOICE_WEEK.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_INVOICE_WEEK.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,14 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_WEEK">
-    <view name="C_INVOICE_WEEK"><![CDATA[SELECT c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DY') AS dateinvoiced, sum(c_invoiceline_v2.linenetamt) AS linenetamt, sum(c_invoiceline_v2.linelistamt) AS linelistamt, sum(c_invoiceline_v2.linelimitamt) AS linelimitamt, sum(c_invoiceline_v2.linediscountamt) AS linediscountamt, 
-CASE sum(c_invoiceline_v2.linelistamt)
-WHEN 0 THEN 0
-ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2)
-END AS linediscount, sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt, 
-CASE sum(c_invoiceline_v2.linenetamt)
-WHEN 0 THEN 0
-ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2)
-END AS lineoverlimit
-FROM c_invoiceline_v2
-GROUP BY c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DY')]]></view>
+    <view name="C_INVOICE_WEEK"><![CDATA[SELECT c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id,  c_invoiceline_v2.salesrep_id,  TRUNC(c_invoiceline_v2.dateinvoiced, 'DY') AS dateinvoiced,  sum(c_invoiceline_v2.linenetamt) AS linenetamt,  sum(c_invoiceline_v2.linelistamt) AS linelistamt,  sum(c_invoiceline_v2.linelimitamt) AS linelimitamt,  sum(c_invoiceline_v2.linediscountamt) AS linediscountamt,  CASE sum(c_invoiceline_v2.linelistamt) WHEN 0 THEN 0 ELSE round((sum(c_invoiceline_v2.linelistamt) - sum(c_invoiceline_v2.linenetamt)) / sum(c_invoiceline_v2.linelistamt) * 100, 2) END AS linediscount,  sum(c_invoiceline_v2.lineoverlimitamt) AS lineoverlimitamt,  CASE sum(c_invoiceline_v2.linenetamt) WHEN 0 THEN 0 ELSE 100 - round((sum(c_invoiceline_v2.linenetamt) - sum(c_invoiceline_v2.lineoverlimitamt)) / sum(c_invoiceline_v2.linenetamt) * 100, 2) END AS lineoverlimit FROM c_invoiceline_v2 GROUP BY c_invoiceline_v2.ad_client_id, c_invoiceline_v2.ad_org_id, c_invoiceline_v2.salesrep_id, TRUNC(c_invoiceline_v2.dateinvoiced, 'DY')]]></view>
   </database>
--- a/src-db/database/model/views/C_ORDER_HEADER_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_ORDER_HEADER_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,15 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_ORDER_HEADER_V">
-    <view name="C_ORDER_HEADER_V"><![CDATA[SELECT o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updated, o.updatedby, to_char('en_US') AS ad_language, o.c_order_id, o.issotrx, o.documentno, o.docstatus, o.c_doctype_id, o.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid, dt.printname AS documenttype, dt.documentnote AS documenttypenote, o.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, o.dateordered, o.datepromised, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, o.description, o.poreference, o.c_currency_id, pt.name AS paymentterm, pt.documentnote AS paymenttermnote, o.c_charge_id, o.chargeamt, o.totallines, o.grandtotal, o.m_pricelist_id, o.istaxincluded, o.c_campaign_id, o.c_project_id, o.c_activity_id, o.m_shipper_id, o.deliveryrule, o.deliveryviarule, o.priorityrule, o.invoicerule
-FROM c_order o
-JOIN c_doctype dt ON o.c_doctype_id = dt.c_doctype_id
-JOIN c_paymentterm pt ON o.c_paymentterm_id = pt.c_paymentterm_id
-JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id
-LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id
-JOIN c_bpartner_location bpl ON o.c_bpartner_location_id = bpl.c_bpartner_location_id
-LEFT JOIN ad_user bpc ON o.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id
-JOIN ad_orginfo oi ON o.ad_org_id = oi.ad_org_id
-LEFT JOIN ad_user u ON o.salesrep_id = u.ad_user_id
-LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
+    <view name="C_ORDER_HEADER_V"><![CDATA[SELECT o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby,  o.updated, o.updatedby, to_char('en_US') AS ad_language, o.c_order_id,  o.issotrx, o.documentno, o.docstatus, o.c_doctype_id, o.c_bpartner_id,  bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid,  dt.printname AS documenttype, dt.documentnote AS documenttypenote,  o.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, o.dateordered,  o.datepromised, bpg.name AS bpgreeting, bp.name, bp.name2,  bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, o.description, o.poreference, o.c_currency_id,  pt.name AS paymentterm, pt.documentnote AS paymenttermnote, o.c_charge_id,  o.chargeamt, o.totallines, o.grandtotal, o.m_pricelist_id, o.istaxincluded,  o.c_campaign_id, o.c_project_id, o.c_activity_id, o.m_shipper_id,  o.deliveryrule, o.deliveryviarule, o.priorityrule, o.invoicerule FROM c_order o JOIN c_doctype dt ON o.c_doctype_id = dt.c_doctype_id JOIN c_paymentterm pt ON o.c_paymentterm_id = pt.c_paymentterm_id JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id JOIN c_bpartner_location bpl ON o.c_bpartner_location_id = bpl.c_bpartner_location_id LEFT JOIN ad_user bpc ON o.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id JOIN ad_orginfo oi ON o.ad_org_id = oi.ad_org_id LEFT JOIN ad_user u ON o.salesrep_id = u.ad_user_id LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
   </database>
--- a/src-db/database/model/views/C_ORDER_HEADER_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_ORDER_HEADER_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,15 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_ORDER_HEADER_VT">
-    <view name="C_ORDER_HEADER_VT"><![CDATA[SELECT o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updated, o.updatedby, dt.ad_language, o.c_order_id, o.issotrx, o.documentno, o.docstatus, o.c_doctype_id, o.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid, dt.printname AS documenttype, dt.documentnote AS documenttypenote, o.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, o.dateordered, o.datepromised, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, o.description, o.poreference, o.c_currency_id, pt.name AS paymentterm, pt.documentnote AS paymenttermnote, o.c_charge_id, o.chargeamt, o.totallines, o.grandtotal, o.m_pricelist_id, o.istaxincluded, o.c_campaign_id, o.c_project_id, o.c_activity_id, o.m_shipper_id, o.deliveryrule, o.deliveryviarule, o.priorityrule, o.invoicerule
-FROM c_order o
-JOIN c_doctype_trl dt ON o.c_doctype_id = dt.c_doctype_id
-JOIN c_paymentterm_trl pt ON o.c_paymentterm_id = pt.c_paymentterm_id AND dt.ad_language = pt.ad_language
-JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id
-LEFT JOIN c_greeting_trl bpg ON bp.c_greeting_id = bpg.c_greeting_id AND dt.ad_language = bpg.ad_language
-JOIN c_bpartner_location bpl ON o.c_bpartner_location_id = bpl.c_bpartner_location_id
-LEFT JOIN ad_user bpc ON o.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting_trl bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id AND dt.ad_language = bpcg.ad_language
-JOIN ad_orginfo oi ON o.ad_org_id = oi.ad_org_id
-LEFT JOIN ad_user u ON o.salesrep_id = u.ad_user_id
-LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
+    <view name="C_ORDER_HEADER_VT"><![CDATA[SELECT o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby,  o.updated, o.updatedby, dt.ad_language, o.c_order_id, o.issotrx,  o.documentno, o.docstatus, o.c_doctype_id, o.c_bpartner_id,  bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid,  dt.printname AS documenttype, dt.documentnote AS documenttypenote,  o.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, o.dateordered,  o.datepromised, bpg.name AS bpgreeting, bp.name, bp.name2,  bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, o.description, o.poreference, o.c_currency_id,  pt.name AS paymentterm, pt.documentnote AS paymenttermnote, o.c_charge_id,  o.chargeamt, o.totallines, o.grandtotal, o.m_pricelist_id, o.istaxincluded,  o.c_campaign_id, o.c_project_id, o.c_activity_id, o.m_shipper_id,  o.deliveryrule, o.deliveryviarule, o.priorityrule, o.invoicerule FROM c_order o JOIN c_doctype_trl dt ON o.c_doctype_id = dt.c_doctype_id JOIN c_paymentterm_trl pt ON o.c_paymentterm_id = pt.c_paymentterm_id AND dt.ad_language = pt.ad_language JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id LEFT JOIN c_greeting_trl bpg ON bp.c_greeting_id = bpg.c_greeting_id AND dt.ad_language = bpg.ad_language JOIN c_bpartner_location bpl ON o.c_bpartner_location_id = bpl.c_bpartner_location_id LEFT JOIN ad_user bpc ON o.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting_trl bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id AND dt.ad_language = bpcg.ad_language JOIN ad_orginfo oi ON o.ad_org_id = oi.ad_org_id LEFT JOIN ad_user u ON o.salesrep_id = u.ad_user_id LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id]]></view>
   </database>
--- a/src-db/database/model/views/C_ORDER_LINETAX_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_ORDER_LINETAX_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,35 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_ORDER_LINETAX_V">
-    <view name="C_ORDER_LINETAX_V"><![CDATA[((SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive, ol.created, ol.createdby, ol.updated, ol.updatedby, 'en_US' AS ad_language, ol.c_order_id, ol.c_orderline_id, ol.c_tax_id, ol.line, ol.qtyordered, uom.uomsymbol, COALESCE(p.name, ol.description) AS name, 
-CASE
-WHEN p.name IS NOT NULL THEN ol.description
-ELSE NULL
-END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, ra.description AS resourcedescription, 
-CASE
-WHEN i.isdiscountprinted = 'Y' THEN ol.pricelist
-ELSE NULL
-END AS pricelist, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND ol.pricelist > ol.priceactual THEN (ol.pricelist - ol.priceactual) / ol.pricelist * 100
-ELSE NULL
-END AS discount, ol.priceactual, ol.linenetamt
-FROM c_orderline ol
-JOIN c_uom uom ON ol.c_uom_id = uom.c_uom_id
-JOIN c_order i ON ol.c_order_id = i.c_order_id
-LEFT JOIN m_product p ON ol.m_product_id = p.m_product_id
-LEFT JOIN s_resourceassignment ra ON ol.s_resourceassignment_id = ra.s_resourceassignment_id
-UNION 
-SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive, ol.created, ol.createdby, ol.updated, ol.updatedby, 'en_US' AS ad_language, ol.c_order_id, ol.c_orderline_id, ol.c_tax_id, ol.line + b.line / 100 AS line, ol.qtyordered * b.bomqty AS qtyordered, uom.uomsymbol, p.name, b.description, p.documentnote, p.upc, p.sku, p.value AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM m_product_bom b
-JOIN c_orderline ol ON b.m_product_id = ol.m_product_id
-JOIN m_product bp ON bp.m_product_id = ol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y'
-JOIN m_product p ON b.m_productbom_id = p.m_product_id
-JOIN c_uom uom ON p.c_uom_id = uom.c_uom_id)
-UNION 
-SELECT c_order.ad_client_id, c_order.ad_org_id, c_order.isactive, c_order.created, c_order.createdby, c_order.updated, c_order.updatedby, 'en_US' AS ad_language, c_order.c_order_id, NULL AS c_orderline_id, NULL AS c_tax_id, NULL AS line, NULL AS qtyordered, NULL AS uomsymbol, NULL AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_order)
-UNION 
-SELECT ot.ad_client_id, ot.ad_org_id, ot.isactive, ot.created, ot.createdby, ot.updated, ot.updatedby, 'en_US' AS ad_language, ot.c_order_id, NULL AS c_orderline_id, ot.c_tax_id, NULL AS line, NULL AS qtyordered, NULL AS uomsymbol, t.name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, ot.taxbaseamt AS priceactual, ot.taxamt AS linenetamt
-FROM c_ordertax ot
-JOIN c_tax t ON ot.c_tax_id = t.c_tax_id]]></view>
+    <view name="C_ORDER_LINETAX_V"><![CDATA[((SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive,  ol.created, ol.createdby, ol.updated, ol.updatedby,  'en_US' AS ad_language, ol.c_order_id,  ol.c_orderline_id, ol.c_tax_id, ol.line,  ol.qtyordered, uom.uomsymbol,  COALESCE(p.name, ol.description) AS name,  CASE WHEN p.name IS NOT NULL THEN ol.description ELSE NULL END AS description,  p.documentnote, p.upc, p.sku,  p.value AS productvalue,  ra.description AS resourcedescription,  CASE WHEN i.isdiscountprinted = 'Y' THEN ol.pricelist ELSE NULL END AS pricelist,  CASE WHEN i.isdiscountprinted = 'Y' AND ol.pricelist > ol.priceactual THEN (ol.pricelist - ol.priceactual) / ol.pricelist * 100 ELSE NULL END AS discount,  ol.priceactual, ol.linenetamt FROM c_orderline ol JOIN c_uom uom ON ol.c_uom_id = uom.c_uom_id JOIN c_order i ON ol.c_order_id = i.c_order_id LEFT JOIN m_product p ON ol.m_product_id = p.m_product_id LEFT JOIN s_resourceassignment ra ON ol.s_resourceassignment_id = ra.s_resourceassignment_id UNION  SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive,  ol.created, ol.createdby, ol.updated, ol.updatedby,  'en_US' AS ad_language, ol.c_order_id,  ol.c_orderline_id, ol.c_tax_id,  ol.line + b.line / 100 AS line,  ol.qtyordered * b.bomqty AS qtyordered,  uom.uomsymbol, p.name, b.description,  p.documentnote, p.upc, p.sku,  p.value AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM m_product_bom b JOIN c_orderline ol ON b.m_product_id = ol.m_product_id JOIN m_product bp ON bp.m_product_id = ol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y' JOIN m_product p ON b.m_productbom_id = p.m_product_id JOIN c_uom uom ON p.c_uom_id = uom.c_uom_id) UNION  SELECT c_order.ad_client_id, c_order.ad_org_id,  c_order.isactive, c_order.created, c_order.createdby,  c_order.updated, c_order.updatedby,  'en_US' AS ad_language, c_order.c_order_id,  NULL AS c_orderline_id,  NULL AS c_tax_id, NULL AS line,  NULL AS qtyordered, NULL AS uomsymbol,  NULL AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  NULL AS priceactual, NULL AS linenetamt FROM c_order) UNION  SELECT ot.ad_client_id, ot.ad_org_id, ot.isactive, ot.created,  ot.createdby, ot.updated, ot.updatedby,  'en_US' AS ad_language, ot.c_order_id,  NULL AS c_orderline_id, ot.c_tax_id,  NULL AS line, NULL AS qtyordered,  NULL AS uomsymbol, t.name,  NULL AS description,  NULL AS documentnote,  NULL AS upc, NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  ot.taxbaseamt AS priceactual, ot.taxamt AS linenetamt FROM c_ordertax ot JOIN c_tax t ON ot.c_tax_id = t.c_tax_id]]></view>
   </database>
--- a/src-db/database/model/views/C_ORDER_LINETAX_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_ORDER_LINETAX_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,39 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_ORDER_LINETAX_VT">
-    <view name="C_ORDER_LINETAX_VT"><![CDATA[((SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive, ol.created, ol.createdby, ol.updated, ol.updatedby, uom.ad_language, ol.c_order_id, ol.c_orderline_id, ol.c_tax_id, ol.line, ol.qtyordered, uom.uomsymbol, COALESCE(COALESCE(pt.name, p.name), ol.description) AS name, 
-CASE
-WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN ol.description
-ELSE NULL
-END AS description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, ra.description AS resourcedescription, 
-CASE
-WHEN i.isdiscountprinted = 'Y' THEN ol.pricelist
-ELSE NULL
-END AS pricelist, 
-CASE
-WHEN i.isdiscountprinted = 'Y' AND ol.pricelist > ol.priceactual THEN (ol.pricelist - ol.priceactual) / ol.pricelist * 100
-ELSE NULL
-END AS discount, ol.priceactual, ol.linenetamt
-FROM c_orderline ol
-JOIN c_uom_trl uom ON ol.c_uom_id = uom.c_uom_id
-JOIN c_order i ON ol.c_order_id = i.c_order_id
-LEFT JOIN m_product p ON ol.m_product_id = p.m_product_id
-LEFT JOIN m_product_trl pt ON ol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language
-LEFT JOIN s_resourceassignment ra ON ol.s_resourceassignment_id = ra.s_resourceassignment_id
-UNION 
-SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive, ol.created, ol.createdby, ol.updated, ol.updatedby, uom.ad_language, ol.c_order_id, ol.c_orderline_id, ol.c_tax_id, ol.line + b.line / 100 AS line, ol.qtyordered * b.bomqty AS qtyordered, uom.uomsymbol, COALESCE(pt.name, p.name) AS name, b.description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM m_product_bom b
-JOIN c_orderline ol ON b.m_product_id = ol.m_product_id
-JOIN m_product bp ON bp.m_product_id = ol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y'
-JOIN m_product p ON b.m_productbom_id = p.m_product_id
-JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id
-JOIN m_product_trl pt ON b.m_productbom_id = pt.m_product_id AND uom.ad_language = pt.ad_language)
-UNION 
-SELECT o.ad_client_id, o.ad_org_id, o.isactive, o.created, o.createdby, o.updated, o.updatedby, l.ad_language, o.c_order_id, NULL AS c_orderline_id, NULL AS c_tax_id, NULL AS line, NULL AS qtyordered, NULL AS uomsymbol, NULL AS name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, NULL AS priceactual, NULL AS linenetamt
-FROM c_order o, ad_language l
-WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y')
-UNION 
-SELECT ot.ad_client_id, ot.ad_org_id, ot.isactive, ot.created, ot.createdby, ot.updated, ot.updatedby, l.ad_language, ot.c_order_id, NULL AS c_orderline_id, ot.c_tax_id, NULL AS line, NULL AS qtyordered, NULL AS uomsymbol, t.name, NULL AS description, NULL AS documentnote, NULL AS upc, NULL AS sku, NULL AS productvalue, NULL AS resourcedescription, NULL AS pricelist, NULL AS discount, ot.taxbaseamt AS priceactual, ot.taxamt AS linenetamt
-FROM c_ordertax ot
-JOIN c_tax t ON ot.c_tax_id = t.c_tax_id, ad_language l
-WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y']]></view>
+    <view name="C_ORDER_LINETAX_VT"><![CDATA[((SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive,  ol.created, ol.createdby, ol.updated, ol.updatedby,  uom.ad_language, ol.c_order_id, ol.c_orderline_id,  ol.c_tax_id, ol.line, ol.qtyordered, uom.uomsymbol,  COALESCE(COALESCE(pt.name, p.name), ol.description) AS name,  CASE WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN ol.description ELSE NULL END AS description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote,  p.upc, p.sku, p.value AS productvalue,  ra.description AS resourcedescription,  CASE WHEN i.isdiscountprinted = 'Y' THEN ol.pricelist ELSE NULL END AS pricelist,  CASE WHEN i.isdiscountprinted = 'Y' AND ol.pricelist > ol.priceactual THEN (ol.pricelist - ol.priceactual) / ol.pricelist * 100 ELSE NULL END AS discount,  ol.priceactual, ol.linenetamt FROM c_orderline ol JOIN c_uom_trl uom ON ol.c_uom_id = uom.c_uom_id JOIN c_order i ON ol.c_order_id = i.c_order_id LEFT JOIN m_product p ON ol.m_product_id = p.m_product_id LEFT JOIN m_product_trl pt ON ol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language LEFT JOIN s_resourceassignment ra ON ol.s_resourceassignment_id = ra.s_resourceassignment_id UNION  SELECT ol.ad_client_id, ol.ad_org_id, ol.isactive,  ol.created, ol.createdby, ol.updated, ol.updatedby,  uom.ad_language, ol.c_order_id, ol.c_orderline_id,  ol.c_tax_id,  ol.line + b.line / 100 AS line,  ol.qtyordered * b.bomqty AS qtyordered,  uom.uomsymbol, COALESCE(pt.name, p.name) AS name,  b.description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote,  p.upc, p.sku, p.value AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist,  NULL AS discount,  NULL AS priceactual,  NULL AS linenetamt FROM m_product_bom b JOIN c_orderline ol ON b.m_product_id = ol.m_product_id JOIN m_product bp ON bp.m_product_id = ol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.isinvoiceprintdetails = 'Y' JOIN m_product p ON b.m_productbom_id = p.m_product_id JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id JOIN m_product_trl pt ON b.m_productbom_id = pt.m_product_id AND uom.ad_language = pt.ad_language) UNION  SELECT o.ad_client_id, o.ad_org_id, o.isactive, o.created,  o.createdby, o.updated, o.updatedby, l.ad_language,  o.c_order_id, NULL AS c_orderline_id,  NULL AS c_tax_id, NULL AS line,  NULL AS qtyordered, NULL AS uomsymbol,  NULL AS name,  NULL AS description,  NULL AS documentnote,  NULL AS upc,  NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  NULL AS priceactual, NULL AS linenetamt FROM c_order o, ad_language l WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y') UNION  SELECT ot.ad_client_id, ot.ad_org_id, ot.isactive, ot.created,  ot.createdby, ot.updated, ot.updatedby, l.ad_language,  ot.c_order_id, NULL AS c_orderline_id,  ot.c_tax_id, NULL AS line, NULL AS qtyordered,  NULL AS uomsymbol, t.name,  NULL AS description,  NULL AS documentnote,  NULL AS upc, NULL AS sku,  NULL AS productvalue,  NULL AS resourcedescription,  NULL AS pricelist, NULL AS discount,  ot.taxbaseamt AS priceactual, ot.taxamt AS linenetamt FROM c_ordertax ot JOIN c_tax t ON ot.c_tax_id = t.c_tax_id, ad_language l WHERE l.isbaselanguage = 'N' AND l.issystemlanguage = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/C_ORDER_OPEN.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_ORDER_OPEN.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_ORDER_OPEN">
-    <view name="C_ORDER_OPEN"><![CDATA[SELECT l.ad_client_id, l.ad_org_id, l.isactive, l.created, l.createdby, l.updated, l.updatedby, o.c_order_id, o.docstatus, o.docaction, o.c_doctype_id, o.salesrep_id, o.c_bpartner_id, o.c_bpartner_location_id, o.ad_user_id, o.poreference, o.c_currency_id, o.issotrx, l.c_orderline_id, l.dateordered, l.datepromised, l.m_product_id, l.m_warehouse_id, l.directship, l.c_uom_id, l.qtyordered, l.qtyreserved, l.qtydelivered, l.qtyinvoiced, l.priceactual, l.qtyordered - l.qtydelivered AS qtytodeliver, l.qtyordered - l.qtyinvoiced AS qtytoinvoice, (l.qtyordered - l.qtyinvoiced) * l.priceactual AS netamttoinvoice
-FROM c_order o, c_orderline l
-WHERE o.c_order_id = l.c_order_id AND (l.qtyordered <> l.qtydelivered OR l.qtyordered <> l.qtyinvoiced)]]></view>
+    <view name="C_ORDER_OPEN"><![CDATA[SELECT l.ad_client_id, l.ad_org_id, l.isactive, l.created, l.createdby,  l.updated, l.updatedby, o.c_order_id, o.docstatus, o.docaction,  o.c_doctype_id, o.salesrep_id, o.c_bpartner_id, o.c_bpartner_location_id,  o.ad_user_id, o.poreference, o.c_currency_id, o.issotrx, l.c_orderline_id,  l.dateordered, l.datepromised, l.m_product_id, l.m_warehouse_id,  l.directship, l.c_uom_id, l.qtyordered, l.qtyreserved, l.qtydelivered,  l.qtyinvoiced, l.priceactual, l.qtyordered - l.qtydelivered AS qtytodeliver,  l.qtyordered - l.qtyinvoiced AS qtytoinvoice,  (l.qtyordered - l.qtyinvoiced) * l.priceactual AS netamttoinvoice FROM c_order o, c_orderline l WHERE o.c_order_id = l.c_order_id AND (l.qtyordered <> l.qtydelivered OR l.qtyordered <> l.qtyinvoiced)]]></view>
   </database>
--- a/src-db/database/model/views/C_PERIODCONTROL_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_PERIODCONTROL_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_PERIODCONTROL_V">
-    <view name="C_PERIODCONTROL_V"><![CDATA[SELECT pc.c_periodcontrol_id AS c_periodcontrol_v_id, pc.ad_client_id, pc.ad_org_id, pc.isactive, pc.created, pc.createdby, pc.updated, pc.updatedby, pc.c_period_id, pc.docbasetype, pc.periodstatus, pc.periodaction, pc.processing, y.c_calendar_id, y.year, p.startdate, p.enddate, p.name
-FROM c_periodcontrol pc, c_period p, c_year y
-WHERE pc.c_period_id = p.c_period_id AND p.c_year_id = y.c_year_id]]></view>
+    <view name="C_PERIODCONTROL_V"><![CDATA[SELECT pc.c_periodcontrol_id AS c_periodcontrol_v_id, pc.ad_client_id,  pc.ad_org_id, pc.isactive, pc.created, pc.createdby, pc.updated,  pc.updatedby, pc.c_period_id, pc.docbasetype, pc.periodstatus,  pc.periodaction, pc.processing, y.c_calendar_id, y.year, p.startdate,  p.enddate, p.name FROM c_periodcontrol pc, c_period p, c_year y WHERE pc.c_period_id = p.c_period_id AND p.c_year_id = y.c_year_id]]></view>
   </database>
--- a/src-db/database/model/views/C_PROJECTPROPOSAL_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_PROJECTPROPOSAL_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_PROJECTPROPOSAL_V">
-    <view name="C_PROJECTPROPOSAL_V"><![CDATA[SELECT p.datesend AS fromdatesend, p.datesend AS todatesend, p.ad_client_id, p.ad_org_id, p.ad_user_id, p.c_bpartner_id, p.c_bpartner_location_id, p.c_project_id, p.c_projectproposal_id, p.issotrx, u.firstname, u.lastname, p.datesend, p.created, p.createdby, p.updated, p.updatedby
-FROM c_projectproposal p, ad_user u, c_project pr
-WHERE p.ad_user_id = u.ad_user_id AND p.c_project_id = pr.c_project_id AND p.isactive = 'Y' AND pr.isactive = 'Y']]></view>
+    <view name="C_PROJECTPROPOSAL_V"><![CDATA[SELECT p.datesend AS fromdatesend, p.datesend AS todatesend, p.ad_client_id,  p.ad_org_id, p.ad_user_id, p.c_bpartner_id, p.c_bpartner_location_id,  p.c_project_id, p.c_projectproposal_id, p.issotrx, u.firstname, u.lastname,  p.datesend, p.created, p.createdby, p.updated, p.updatedby FROM c_projectproposal p, ad_user u, c_project pr WHERE p.ad_user_id = u.ad_user_id AND p.c_project_id = pr.c_project_id AND p.isactive = 'Y' AND pr.isactive = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/C_PROJECT_DETAILS_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_PROJECT_DETAILS_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,12 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_PROJECT_DETAILS_V">
-    <view name="C_PROJECT_DETAILS_V"><![CDATA[SELECT pl.ad_client_id, pl.ad_org_id, pl.isactive, pl.created, pl.createdby, pl.updated, pl.updatedby, to_char('en_US') AS ad_language, pj.c_project_id, pl.c_projectline_id, pl.line, pl.plannedqty, pl.plannedprice, pl.plannedamt, pl.plannedmarginamt, pl.committedamt, pl.m_product_id, COALESCE(p.name, pl.description) AS name, 
-CASE
-WHEN p.name IS NOT NULL THEN pl.description
-ELSE NULL
-END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, pl.m_product_category_id, pl.invoicedamt, pl.invoicedqty, pl.committedqty
-FROM c_projectline pl
-JOIN c_project pj ON pl.c_project_id = pj.c_project_id
-LEFT JOIN m_product p ON pl.m_product_id = p.m_product_id
-WHERE pl.isprinted = 'Y']]></view>
+    <view name="C_PROJECT_DETAILS_V"><![CDATA[SELECT pl.ad_client_id, pl.ad_org_id, pl.isactive, pl.created, pl.createdby,  pl.updated, pl.updatedby, to_char('en_US') AS ad_language,  pj.c_project_id, pl.c_projectline_id, pl.line, pl.plannedqty,  pl.plannedprice, pl.plannedamt, pl.plannedmarginamt, pl.committedamt,  pl.m_product_id, COALESCE(p.name, pl.description) AS name,  CASE WHEN p.name IS NOT NULL THEN pl.description ELSE NULL END AS description,  p.documentnote, p.upc, p.sku, p.value AS productvalue,  pl.m_product_category_id, pl.invoicedamt, pl.invoicedqty, pl.committedqty FROM c_projectline pl JOIN c_project pj ON pl.c_project_id = pj.c_project_id LEFT JOIN m_product p ON pl.m_product_id = p.m_product_id WHERE pl.isprinted = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/C_PROJECT_DETAILS_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_PROJECT_DETAILS_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,12 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_PROJECT_DETAILS_VT">
-    <view name="C_PROJECT_DETAILS_VT"><![CDATA[SELECT pl.ad_client_id, pl.ad_org_id, pl.isactive, pl.created, pl.createdby, pl.updated, pl.updatedby, to_char('en_US') AS ad_language, pj.c_project_id, pl.c_projectline_id, pl.line, pl.plannedqty, pl.plannedprice, pl.plannedamt, pl.plannedmarginamt, pl.committedamt, pl.m_product_id, COALESCE(p.name, pl.description) AS name, 
-CASE
-WHEN p.name IS NOT NULL THEN pl.description
-ELSE NULL
-END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, pl.m_product_category_id, pl.invoicedamt, pl.invoicedqty, pl.committedqty
-FROM c_projectline pl
-JOIN c_project pj ON pl.c_project_id = pj.c_project_id
-LEFT JOIN m_product p ON pl.m_product_id = p.m_product_id
-WHERE pl.isprinted = 'Y']]></view>
+    <view name="C_PROJECT_DETAILS_VT"><![CDATA[SELECT pl.ad_client_id, pl.ad_org_id, pl.isactive, pl.created, pl.createdby,  pl.updated, pl.updatedby, to_char('en_US') AS ad_language,  pj.c_project_id, pl.c_projectline_id, pl.line, pl.plannedqty,  pl.plannedprice, pl.plannedamt, pl.plannedmarginamt, pl.committedamt,  pl.m_product_id, COALESCE(p.name, pl.description) AS name,  CASE WHEN p.name IS NOT NULL THEN pl.description ELSE NULL END AS description,  p.documentnote, p.upc, p.sku, p.value AS productvalue,  pl.m_product_category_id, pl.invoicedamt, pl.invoicedqty, pl.committedqty FROM c_projectline pl JOIN c_project pj ON pl.c_project_id = pj.c_project_id LEFT JOIN m_product p ON pl.m_product_id = p.m_product_id WHERE pl.isprinted = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/C_PROJECT_HEADER_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_PROJECT_HEADER_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,16 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_PROJECT_HEADER_V">
-    <view name="C_PROJECT_HEADER_V"><![CDATA[SELECT p.ad_client_id, p.ad_org_id, p.isactive, p.created, p.createdby, p.updated, p.updatedby, to_char('en_US') AS ad_language, p.c_project_id, p.value, p.name AS projectname, p.description, p.note, p.issummary, p.projectcategory, oi.c_location_id AS org_location_id, oi.taxid, p.c_projecttype_id, pjt.name AS projecttypename, p.c_phase_id, pjp.name AS projectphasename, p.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, p.c_bpartner_id, bp.value AS bpvalue, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, pt.name AS paymentterm, pt.documentnote AS paymenttermnote, p.poreference, p.c_currency_id, p.m_pricelist_version_id, p.c_campaign_id, p.plannedamt, p.plannedqty, p.plannedmarginamt, p.invoicedamt, p.invoicedqty, p.projectbalanceamt, p.iscommitment, p.committedamt, p.committedqty, p.datecontract, p.datefinish, p.iscommitceiling, p.m_warehouse_id
-FROM c_project p
-LEFT JOIN c_bpartner bp ON p.c_bpartner_id = bp.c_bpartner_id
-JOIN ad_orginfo oi ON p.ad_org_id = oi.ad_org_id
-LEFT JOIN c_projecttype pjt ON p.c_projecttype_id = pjt.c_projecttype_id
-LEFT JOIN c_phase pjp ON p.c_phase_id = pjp.c_phase_id
-LEFT JOIN ad_user u ON p.salesrep_id = u.ad_user_id
-LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id
-LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id
-LEFT JOIN ad_user bpc ON p.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id
-LEFT JOIN c_bpartner_location bpl ON p.c_bpartner_location_id = bpl.c_bpartner_location_id
-LEFT JOIN c_paymentterm pt ON p.c_paymentterm_id = pt.c_paymentterm_id]]></view>
+    <view name="C_PROJECT_HEADER_V"><![CDATA[SELECT p.ad_client_id, p.ad_org_id, p.isactive, p.created, p.createdby,  p.updated, p.updatedby, to_char('en_US') AS ad_language,  p.c_project_id, p.value, p.name AS projectname, p.description, p.note,  p.issummary, p.projectcategory, oi.c_location_id AS org_location_id,  oi.taxid, p.c_projecttype_id, pjt.name AS projecttypename, p.c_phase_id,  pjp.name AS projectphasename, p.salesrep_id,  COALESCE(ubp.name, u.name) AS salesrep_name, p.c_bpartner_id,  bp.value AS bpvalue, bpg.name AS bpgreeting, bp.name, bp.name2,  bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, pt.name AS paymentterm, pt.documentnote AS paymenttermnote,  p.poreference, p.c_currency_id, p.m_pricelist_version_id, p.c_campaign_id,  p.plannedamt, p.plannedqty, p.plannedmarginamt, p.invoicedamt,  p.invoicedqty, p.projectbalanceamt, p.iscommitment, p.committedamt,  p.committedqty, p.datecontract, p.datefinish, p.iscommitceiling,  p.m_warehouse_id FROM c_project p LEFT JOIN c_bpartner bp ON p.c_bpartner_id = bp.c_bpartner_id JOIN ad_orginfo oi ON p.ad_org_id = oi.ad_org_id LEFT JOIN c_projecttype pjt ON p.c_projecttype_id = pjt.c_projecttype_id LEFT JOIN c_phase pjp ON p.c_phase_id = pjp.c_phase_id LEFT JOIN ad_user u ON p.salesrep_id = u.ad_user_id LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id LEFT JOIN ad_user bpc ON p.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id LEFT JOIN c_bpartner_location bpl ON p.c_bpartner_location_id = bpl.c_bpartner_location_id LEFT JOIN c_paymentterm pt ON p.c_paymentterm_id = pt.c_paymentterm_id]]></view>
   </database>
--- a/src-db/database/model/views/C_PROJECT_HEADER_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/C_PROJECT_HEADER_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,16 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_PROJECT_HEADER_VT">
-    <view name="C_PROJECT_HEADER_VT"><![CDATA[SELECT p.ad_client_id, p.ad_org_id, p.isactive, p.created, p.createdby, p.updated, p.updatedby, pt.ad_language, p.c_project_id, p.value, p.name AS projectname, p.description, p.note, p.issummary, p.projectcategory, oi.c_location_id AS org_location_id, oi.taxid, p.c_projecttype_id, pjt.name AS projecttypename, p.c_phase_id, pjp.name AS projectphasename, p.salesrep_id, COALESCE(ubp.name, u.name) AS salesrep_name, p.c_bpartner_id, bp.value AS bpvalue, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, pt.name AS paymentterm, pt.documentnote AS paymenttermnote, p.poreference, p.c_currency_id, p.m_pricelist_version_id, p.c_campaign_id, p.plannedamt, p.plannedqty, p.plannedmarginamt, p.invoicedamt, p.invoicedqty, p.projectbalanceamt, p.iscommitment, p.committedamt, p.committedqty, p.datecontract, p.datefinish, p.iscommitceiling, p.m_warehouse_id
-FROM c_project p
-LEFT JOIN c_bpartner bp ON p.c_bpartner_id = bp.c_bpartner_id
-JOIN ad_orginfo oi ON p.ad_org_id = oi.ad_org_id
-LEFT JOIN c_paymentterm_trl pt ON p.c_paymentterm_id = pt.c_paymentterm_id
-LEFT JOIN c_projecttype pjt ON p.c_projecttype_id = pjt.c_projecttype_id
-LEFT JOIN c_phase pjp ON p.c_phase_id = pjp.c_phase_id
-LEFT JOIN ad_user u ON p.salesrep_id = u.ad_user_id
-LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id
-LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id
-LEFT JOIN ad_user bpc ON p.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id
-LEFT JOIN c_bpartner_location bpl ON p.c_bpartner_location_id = bpl.c_bpartner_location_id]]></view>
+    <view name="C_PROJECT_HEADER_VT"><![CDATA[SELECT p.ad_client_id, p.ad_org_id, p.isactive, p.created, p.createdby,  p.updated, p.updatedby, pt.ad_language, p.c_project_id, p.value,  p.name AS projectname, p.description, p.note, p.issummary,  p.projectcategory, oi.c_location_id AS org_location_id, oi.taxid,  p.c_projecttype_id, pjt.name AS projecttypename, p.c_phase_id,  pjp.name AS projectphasename, p.salesrep_id,  COALESCE(ubp.name, u.name) AS salesrep_name, p.c_bpartner_id,  bp.value AS bpvalue, bpg.name AS bpgreeting, bp.name, bp.name2,  bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, pt.name AS paymentterm, pt.documentnote AS paymenttermnote,  p.poreference, p.c_currency_id, p.m_pricelist_version_id, p.c_campaign_id,  p.plannedamt, p.plannedqty, p.plannedmarginamt, p.invoicedamt,  p.invoicedqty, p.projectbalanceamt, p.iscommitment, p.committedamt,  p.committedqty, p.datecontract, p.datefinish, p.iscommitceiling,  p.m_warehouse_id FROM c_project p LEFT JOIN c_bpartner bp ON p.c_bpartner_id = bp.c_bpartner_id JOIN ad_orginfo oi ON p.ad_org_id = oi.ad_org_id LEFT JOIN c_paymentterm_trl pt ON p.c_paymentterm_id = pt.c_paymentterm_id LEFT JOIN c_projecttype pjt ON p.c_projecttype_id = pjt.c_projecttype_id LEFT JOIN c_phase pjp ON p.c_phase_id = pjp.c_phase_id LEFT JOIN ad_user u ON p.salesrep_id = u.ad_user_id LEFT JOIN c_bpartner ubp ON u.c_bpartner_id = ubp.c_bpartner_id LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id LEFT JOIN ad_user bpc ON p.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id LEFT JOIN c_bpartner_location bpl ON p.c_bpartner_location_id = bpl.c_bpartner_location_id]]></view>
   </database>
--- a/src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/FIN_PAYMENT_DETAIL_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,12 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW FIN_PAYMENT_DETAIL_V">
-    <view name="FIN_PAYMENT_DETAIL_V"><![CDATA[SELECT psd.fin_payment_scheduledetail_id AS fin_payment_detail_v_id, psd.ad_client_id, psd.ad_org_id, psd.isactive, psd.created, psd.createdby, psd.updated, psd.updatedby, psi.fin_payment_schedule_id AS fin_payment_sched_inv_v_id, pso.fin_payment_schedule_id AS fin_payment_sched_ord_v_id, i.documentno AS invoiceno, o.documentno AS orderno, p.documentno AS paymentno, pd.fin_payment_id, COALESCE(psi.duedate, pso.duedate) AS duedate, COALESCE(i.grandtotal, o.grandtotal) AS invoicedamt, COALESCE(psi.amount, pso.amount) AS expected, psd.amount AS paidamt, p.c_bpartner_id, p.fin_paymentmethod_id, p.fin_financial_account_id, p.c_currency_id, p.paymentdate, gli.name AS glitemname, pd.writeoffamt, psd.iscanceled, psd.c_bpartner_id AS c_bpartner_id_dim, psd.c_activity_id, psd.m_product_id, psd.c_campaign_id, psd.c_project_id, psd.c_salesregion_id
-FROM fin_payment p, fin_payment_detail pd
-JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id
-LEFT JOIN fin_payment_schedule psi ON psd.fin_payment_schedule_invoice = psi.fin_payment_schedule_id
-LEFT JOIN c_invoice i ON psi.c_invoice_id = i.c_invoice_id
-LEFT JOIN fin_payment_schedule pso ON psd.fin_payment_schedule_order = pso.fin_payment_schedule_id
-LEFT JOIN c_order o ON pso.c_order_id = o.c_order_id
-LEFT JOIN c_glitem gli ON pd.c_glitem_id = gli.c_glitem_id
-WHERE p.fin_payment_id = pd.fin_payment_id]]></view>
+    <view name="FIN_PAYMENT_DETAIL_V"><![CDATA[SELECT psd.fin_payment_scheduledetail_id AS fin_payment_detail_v_id,  psd.ad_client_id, psd.ad_org_id, psd.isactive, psd.created, psd.createdby,  psd.updated, psd.updatedby,  psi.fin_payment_schedule_id AS fin_payment_sched_inv_v_id,  pso.fin_payment_schedule_id AS fin_payment_sched_ord_v_id,  i.documentno AS invoiceno, o.documentno AS orderno,  p.documentno AS paymentno, pd.fin_payment_id,  COALESCE(psi.duedate, pso.duedate) AS duedate,  COALESCE(i.grandtotal, o.grandtotal) AS invoicedamt,  COALESCE(psi.amount, pso.amount) AS expected, psd.amount AS paidamt,  p.c_bpartner_id, p.fin_paymentmethod_id, p.fin_financial_account_id,  p.c_currency_id, p.paymentdate, gli.name AS glitemname, pd.writeoffamt,  psd.iscanceled, psd.c_bpartner_id AS c_bpartner_id_dim, psd.c_activity_id,  psd.m_product_id, psd.c_campaign_id, psd.c_project_id, psd.c_salesregion_id FROM fin_payment p,  fin_payment_detail pd JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id LEFT JOIN fin_payment_schedule psi ON psd.fin_payment_schedule_invoice = psi.fin_payment_schedule_id LEFT JOIN c_invoice i ON psi.c_invoice_id = i.c_invoice_id LEFT JOIN fin_payment_schedule pso ON psd.fin_payment_schedule_order = pso.fin_payment_schedule_id LEFT JOIN c_order o ON pso.c_order_id = o.c_order_id LEFT JOIN c_glitem gli ON pd.c_glitem_id = gli.c_glitem_id WHERE p.fin_payment_id = pd.fin_payment_id]]></view>
   </database>
--- a/src-db/database/model/views/FIN_PAYMENT_EXEC_HISTORY_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/FIN_PAYMENT_EXEC_HISTORY_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW FIN_PAYMENT_EXEC_HISTORY_V">
-    <view name="FIN_PAYMENT_EXEC_HISTORY_V"><![CDATA[SELECT prp.fin_payment_run_payment_id AS fin_payment_exec_history_v_id, prp.fin_payment_id, prp.ad_client_id, prp.ad_org_id, prp.created, prp.createdby, prp.updated, prp.updatedby, prp.isactive, prp.created AS executiondate, pr.fin_payment_run_id, pr.message AS prun_message, pr.status AS prun_status, pr.run_source AS prun_source, prp.result AS paymentexec_result, prp.message AS paymentexec_message
-FROM fin_payment_run pr
-JOIN fin_payment_run_payment prp ON pr.fin_payment_run_id = prp.fin_payment_run_id]]></view>
+    <view name="FIN_PAYMENT_EXEC_HISTORY_V"><![CDATA[SELECT prp.fin_payment_run_payment_id AS fin_payment_exec_history_v_id,  prp.fin_payment_id, prp.ad_client_id, prp.ad_org_id, prp.created,  prp.createdby, prp.updated, prp.updatedby, prp.isactive,  prp.created AS executiondate, pr.fin_payment_run_id,  pr.message AS prun_message, pr.status AS prun_status,  pr.run_source AS prun_source, prp.result AS paymentexec_result,  prp.message AS paymentexec_message FROM fin_payment_run pr JOIN fin_payment_run_payment prp ON pr.fin_payment_run_id = prp.fin_payment_run_id]]></view>
   </database>
--- a/src-db/database/model/views/FIN_PAYMENT_PROP_DETAIL_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/FIN_PAYMENT_PROP_DETAIL_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,12 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW FIN_PAYMENT_PROP_DETAIL_V">
-    <view name="FIN_PAYMENT_PROP_DETAIL_V"><![CDATA[SELECT ppd.fin_payment_prop_detail_id AS fin_payment_prop_detail_v_id, ppd.ad_client_id, ppd.ad_org_id, ppd.isactive, ppd.created, ppd.createdby, ppd.updated, ppd.updatedby, psd.fin_payment_scheduledetail_id, ppd.fin_payment_proposal_id, i.documentno AS invoiceno, o.documentno AS orderno, p.documentno AS paymentno, pd.fin_payment_id, COALESCE(psi.duedate, pso.duedate) AS duedate, COALESCE(i.grandtotal, o.grandtotal) AS invoicedamt, COALESCE(psi.expected, pso.expected) AS expected, ppd.amount AS paidamt, COALESCE(p.c_bpartner_id, i.c_bpartner_id, o.c_bpartner_id) AS c_bpartner_id, ppd.writeoffamt
-FROM fin_payment_prop_detail ppd, fin_payment_scheduledetail psd
-LEFT JOIN fin_payment_sched_inv_v psi ON psd.fin_payment_schedule_invoice = psi.fin_payment_sched_inv_v_id
-LEFT JOIN c_invoice i ON psi.c_invoice_id = i.c_invoice_id
-LEFT JOIN fin_payment_sched_ord_v pso ON psd.fin_payment_schedule_order = pso.fin_payment_sched_ord_v_id
-LEFT JOIN c_order o ON pso.c_order_id = o.c_order_id
-LEFT JOIN fin_payment_detail pd ON psd.fin_payment_detail_id = pd.fin_payment_detail_id
-LEFT JOIN fin_payment p ON pd.fin_payment_id = p.fin_payment_id
-WHERE ppd.fin_payment_scheduledetail_id = psd.fin_payment_scheduledetail_id]]></view>
+    <view name="FIN_PAYMENT_PROP_DETAIL_V"><![CDATA[SELECT ppd.fin_payment_prop_detail_id AS fin_payment_prop_detail_v_id,  ppd.ad_client_id, ppd.ad_org_id, ppd.isactive, ppd.created, ppd.createdby,  ppd.updated, ppd.updatedby, psd.fin_payment_scheduledetail_id,  ppd.fin_payment_proposal_id, i.documentno AS invoiceno,  o.documentno AS orderno, p.documentno AS paymentno, pd.fin_payment_id,  COALESCE(psi.duedate, pso.duedate) AS duedate,  COALESCE(i.grandtotal, o.grandtotal) AS invoicedamt,  COALESCE(psi.expected, pso.expected) AS expected, ppd.amount AS paidamt,  COALESCE(p.c_bpartner_id, i.c_bpartner_id, o.c_bpartner_id) AS c_bpartner_id,  ppd.writeoffamt FROM fin_payment_prop_detail ppd,  fin_payment_scheduledetail psd LEFT JOIN fin_payment_sched_inv_v psi ON psd.fin_payment_schedule_invoice = psi.fin_payment_sched_inv_v_id LEFT JOIN c_invoice i ON psi.c_invoice_id = i.c_invoice_id LEFT JOIN fin_payment_sched_ord_v pso ON psd.fin_payment_schedule_order = pso.fin_payment_sched_ord_v_id LEFT JOIN c_order o ON pso.c_order_id = o.c_order_id LEFT JOIN fin_payment_detail pd ON psd.fin_payment_detail_id = pd.fin_payment_detail_id LEFT JOIN fin_payment p ON pd.fin_payment_id = p.fin_payment_id WHERE ppd.fin_payment_scheduledetail_id = psd.fin_payment_scheduledetail_id]]></view>
   </database>
--- a/src-db/database/model/views/FIN_PAYMENT_SCHED_INV_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/FIN_PAYMENT_SCHED_INV_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,11 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW FIN_PAYMENT_SCHED_INV_V">
-    <view name="FIN_PAYMENT_SCHED_INV_V"><![CDATA[SELECT ps.fin_payment_schedule_id AS fin_payment_sched_inv_v_id, ps.ad_client_id, ps.ad_org_id, ps.isactive, ps.created, ps.createdby, ps.updated, ps.updatedby, ps.c_invoice_id, ps.c_order_id, ps.duedate, ps.fin_paymentmethod_id, ps.amount AS expected, ps.paidamt AS received, ps.outstandingamt AS outstanding, ps.c_currency_id, (SELECT max(p.paymentdate) AS max
-FROM fin_payment p
-LEFT JOIN fin_payment_detail pd ON pd.fin_payment_id = p.fin_payment_id
-LEFT JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id
-WHERE ps.c_invoice_id IS NOT NULL AND psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS lastpayment, (SELECT count(*) AS count
-FROM fin_payment_detail pd, fin_payment_scheduledetail psd
-WHERE pd.fin_payment_detail_id = psd.fin_payment_detail_id AND ps.c_invoice_id IS NOT NULL AND psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS numberofpayments, ps.fin_payment_priority_id, ps.update_payment_plan
-FROM fin_payment_schedule ps]]></view>
+    <view name="FIN_PAYMENT_SCHED_INV_V"><![CDATA[SELECT ps.fin_payment_schedule_id AS fin_payment_sched_inv_v_id,  ps.ad_client_id, ps.ad_org_id, ps.isactive, ps.created, ps.createdby,  ps.updated, ps.updatedby, ps.c_invoice_id, ps.c_order_id, ps.duedate,  ps.fin_paymentmethod_id, ps.amount AS expected, ps.paidamt AS received,  ps.outstandingamt AS outstanding, ps.c_currency_id,  (SELECT max(p.paymentdate) AS max FROM fin_payment p LEFT JOIN fin_payment_detail pd ON pd.fin_payment_id = p.fin_payment_id LEFT JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id WHERE ps.c_invoice_id IS NOT NULL AND psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS lastpayment,  (SELECT count(*) AS count FROM fin_payment_detail pd, fin_payment_scheduledetail psd WHERE pd.fin_payment_detail_id = psd.fin_payment_detail_id AND ps.c_invoice_id IS NOT NULL AND psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id) AS numberofpayments,  ps.fin_payment_priority_id, ps.update_payment_plan FROM fin_payment_schedule ps]]></view>
   </database>
--- a/src-db/database/model/views/FIN_PAYMENT_SCHED_ORD_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/FIN_PAYMENT_SCHED_ORD_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,11 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW FIN_PAYMENT_SCHED_ORD_V">
-    <view name="FIN_PAYMENT_SCHED_ORD_V"><![CDATA[SELECT ps.fin_payment_schedule_id AS fin_payment_sched_ord_v_id, ps.ad_client_id, ps.ad_org_id, ps.isactive, ps.created, ps.createdby, ps.updated, ps.updatedby, ps.c_invoice_id, ps.c_order_id, ps.duedate, ps.fin_paymentmethod_id, ps.amount AS expected, ps.paidamt AS received, ps.outstandingamt AS outstanding, ps.c_currency_id, (SELECT max(p.paymentdate) AS max
-FROM fin_payment p
-LEFT JOIN fin_payment_detail pd ON pd.fin_payment_id = p.fin_payment_id
-LEFT JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id
-WHERE ps.c_order_id IS NOT NULL AND psd.fin_payment_schedule_order = ps.fin_payment_schedule_id) AS lastpayment, (SELECT count(*) AS count
-FROM fin_payment_detail pd, fin_payment_scheduledetail psd
-WHERE pd.fin_payment_detail_id = psd.fin_payment_detail_id AND ps.c_order_id IS NOT NULL AND psd.fin_payment_schedule_order = ps.fin_payment_schedule_id) AS numberofpayments, ps.fin_payment_priority_id, ps.update_payment_plan
-FROM fin_payment_schedule ps]]></view>
+    <view name="FIN_PAYMENT_SCHED_ORD_V"><![CDATA[SELECT ps.fin_payment_schedule_id AS fin_payment_sched_ord_v_id,  ps.ad_client_id, ps.ad_org_id, ps.isactive, ps.created, ps.createdby,  ps.updated, ps.updatedby, ps.c_invoice_id, ps.c_order_id, ps.duedate,  ps.fin_paymentmethod_id, ps.amount AS expected, ps.paidamt AS received,  ps.outstandingamt AS outstanding, ps.c_currency_id,  (SELECT max(p.paymentdate) AS max FROM fin_payment p LEFT JOIN fin_payment_detail pd ON pd.fin_payment_id = p.fin_payment_id LEFT JOIN fin_payment_scheduledetail psd ON pd.fin_payment_detail_id = psd.fin_payment_detail_id WHERE ps.c_order_id IS NOT NULL AND psd.fin_payment_schedule_order = ps.fin_payment_schedule_id) AS lastpayment,  (SELECT count(*) AS count FROM fin_payment_detail pd, fin_payment_scheduledetail psd WHERE pd.fin_payment_detail_id = psd.fin_payment_detail_id AND ps.c_order_id IS NOT NULL AND psd.fin_payment_schedule_order = ps.fin_payment_schedule_id) AS numberofpayments,  ps.fin_payment_priority_id, ps.update_payment_plan FROM fin_payment_schedule ps]]></view>
   </database>
--- a/src-db/database/model/views/FIN_RECONCILIATIONLINE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/FIN_RECONCILIATIONLINE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW FIN_RECONCILIATIONLINE_V">
-    <view name="FIN_RECONCILIATIONLINE_V"><![CDATA[SELECT fin_finacc_transaction.fin_finacc_transaction_id AS fin_reconciliationline_v_id, fin_finacc_transaction.fin_finacc_transaction_id, fin_finacc_transaction.ad_client_id, fin_finacc_transaction.ad_org_id, fin_finacc_transaction.created, fin_finacc_transaction.createdby, fin_finacc_transaction.updated, fin_finacc_transaction.updatedby, fin_finacc_transaction.isactive, fin_finacc_transaction.fin_payment_id, fin_finacc_transaction.c_currency_id, fin_finacc_transaction.fin_financial_account_id, fin_finacc_transaction.dateacct, fin_finacc_transaction.c_glitem_id, fin_finacc_transaction.paymentamt, fin_finacc_transaction.depositamt, fin_finacc_transaction.c_project_id, fin_finacc_transaction.c_campaign_id, fin_finacc_transaction.c_activity_id, fin_finacc_transaction.user1_id, fin_finacc_transaction.user2_id, fin_finacc_transaction.trxtype, fin_finacc_transaction.statementdate, fin_finacc_transaction.description, fin_finacc_transaction.fin_reconciliation_id, fin_bankstatementline.fin_bankstatementline_id
-FROM fin_finacc_transaction
-LEFT JOIN fin_bankstatementline ON fin_finacc_transaction.fin_finacc_transaction_id = fin_bankstatementline.fin_finacc_transaction_id]]></view>
+    <view name="FIN_RECONCILIATIONLINE_V"><![CDATA[SELECT fin_finacc_transaction.fin_finacc_transaction_id AS fin_reconciliationline_v_id,  fin_finacc_transaction.fin_finacc_transaction_id,  fin_finacc_transaction.ad_client_id, fin_finacc_transaction.ad_org_id,  fin_finacc_transaction.created, fin_finacc_transaction.createdby,  fin_finacc_transaction.updated, fin_finacc_transaction.updatedby,  fin_finacc_transaction.isactive, fin_finacc_transaction.fin_payment_id,  fin_finacc_transaction.c_currency_id,  fin_finacc_transaction.fin_financial_account_id,  fin_finacc_transaction.dateacct, fin_finacc_transaction.c_glitem_id,  fin_finacc_transaction.paymentamt, fin_finacc_transaction.depositamt,  fin_finacc_transaction.c_project_id, fin_finacc_transaction.c_campaign_id,  fin_finacc_transaction.c_activity_id, fin_finacc_transaction.user1_id,  fin_finacc_transaction.user2_id, fin_finacc_transaction.trxtype,  fin_finacc_transaction.statementdate, fin_finacc_transaction.description,  fin_finacc_transaction.fin_reconciliation_id,  fin_bankstatementline.fin_bankstatementline_id FROM fin_finacc_transaction LEFT JOIN fin_bankstatementline ON fin_finacc_transaction.fin_finacc_transaction_id = fin_bankstatementline.fin_finacc_transaction_id]]></view>
   </database>
--- a/src-db/database/model/views/GL_JOURNALLINE_ACCT_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/GL_JOURNALLINE_ACCT_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW GL_JOURNALLINE_ACCT_V">
-    <view name="GL_JOURNALLINE_ACCT_V"><![CDATA[SELECT gl.gl_journalline_id, gl.ad_client_id, gl.ad_org_id, gl.isactive, gl.created, gl.createdby, gl.updated, gl.updatedby, gl.gl_journal_id, gl.line, gl.isgenerated, gl.description, gl.amtsourcedr, gl.amtsourcecr, gl.c_currency_id, gl.currencyratetype, gl.currencyrate, gl.dateacct, gl.amtacctdr, gl.amtacctcr, gl.c_uom_id, gl.qty, gl.c_validcombination_id, vc.c_acctschema_id, vc.account_id, vc.m_product_id, vc.c_bpartner_id, vc.ad_orgtrx_id, vc.c_locfrom_id, vc.c_locto_id, vc.c_salesregion_id, vc.c_project_id, vc.c_campaign_id, vc.user1_id, vc.user2_id, vc.isfullyqualified, vc.c_activity_id
-FROM gl_journalline gl, c_validcombination vc
-WHERE gl.c_validcombination_id = vc.c_validcombination_id]]></view>
+    <view name="GL_JOURNALLINE_ACCT_V"><![CDATA[SELECT gl.gl_journalline_id, gl.ad_client_id, gl.ad_org_id, gl.isactive,  gl.created, gl.createdby, gl.updated, gl.updatedby, gl.gl_journal_id,  gl.line, gl.isgenerated, gl.description, gl.amtsourcedr, gl.amtsourcecr,  gl.c_currency_id, gl.currencyratetype, gl.currencyrate, gl.dateacct,  gl.amtacctdr, gl.amtacctcr, gl.c_uom_id, gl.qty, gl.c_validcombination_id,  vc.c_acctschema_id, vc.account_id, vc.m_product_id, vc.c_bpartner_id,  vc.ad_orgtrx_id, vc.c_locfrom_id, vc.c_locto_id, vc.c_salesregion_id,  vc.c_project_id, vc.c_campaign_id, vc.user1_id, vc.user2_id,  vc.isfullyqualified, vc.c_activity_id FROM gl_journalline gl, c_validcombination vc WHERE gl.c_validcombination_id = vc.c_validcombination_id]]></view>
   </database>
--- a/src-db/database/model/views/MA_PROCESSPLAN_TOTALIZED.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/MA_PROCESSPLAN_TOTALIZED.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,22 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW MA_PROCESSPLAN_TOTALIZED">
-    <view name="MA_PROCESSPLAN_TOTALIZED"><![CDATA[SELECT ma_processplan_version.ma_processplan_id, ma_processplan_version.ma_processplan_version_id, m_product.m_product_id AS produced, sp1.qty AS proqty, sp2.m_product_id AS dependantproduct, sp2.qty AS depqty
-FROM m_product, ma_processplan, ma_processplan_version, (SELECT ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id, sum(
-CASE ma_sequenceproduct.productiontype
-WHEN '+' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier
-WHEN '-' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier * (-1)
-ELSE NULL
-END) AS qty
-FROM ma_sequence, ma_sequenceproduct
-WHERE ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequence.isactive = 'Y' AND ma_sequenceproduct.isactive = 'Y'
-GROUP BY ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id) sp1, (SELECT ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id, sum(
-CASE ma_sequenceproduct.productiontype
-WHEN '+' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier
-WHEN '-' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier * (-1)
-ELSE NULL
-END) AS qty
-FROM ma_sequence, ma_sequenceproduct
-WHERE ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequence.isactive = 'Y' AND ma_sequenceproduct.isactive = 'Y'
-GROUP BY ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id) sp2
-WHERE ma_processplan.ma_processplan_id = ma_processplan_version.ma_processplan_id AND m_product.ma_processplan_id = ma_processplan_version.ma_processplan_id AND ma_processplan.isactive = 'Y' AND ma_processplan_version.isactive = 'Y' AND ma_processplan_version.datefrom <= now() AND ma_processplan_version.dateto > now() AND ma_processplan_version.ma_processplan_version_id = sp1.ma_processplan_version_id AND ma_processplan_version.ma_processplan_version_id = sp2.ma_processplan_version_id AND sp1.m_product_id = m_product.m_product_id AND sp2.m_product_id <> m_product.m_product_id AND sp1.qty > 0 AND sp2.qty <> 0]]></view>
+    <view name="MA_PROCESSPLAN_TOTALIZED"><![CDATA[SELECT ma_processplan_version.ma_processplan_id,  ma_processplan_version.ma_processplan_version_id,  m_product.m_product_id AS produced, sp1.qty AS proqty,  sp2.m_product_id AS dependantproduct, sp2.qty AS depqty FROM m_product, ma_processplan, ma_processplan_version,  (SELECT ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id,  sum(CASE ma_sequenceproduct.productiontype WHEN '+' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier WHEN '-' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier * (-1) ELSE NULL END) AS qty FROM ma_sequence, ma_sequenceproduct WHERE ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequence.isactive = 'Y' AND ma_sequenceproduct.isactive = 'Y' GROUP BY ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id) sp1,  (SELECT ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id,  sum(CASE ma_sequenceproduct.productiontype WHEN '+' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier WHEN '-' THEN ma_sequenceproduct.quantity * ma_sequence.multiplier * (-1) ELSE NULL END) AS qty FROM ma_sequence, ma_sequenceproduct WHERE ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequence.isactive = 'Y' AND ma_sequenceproduct.isactive = 'Y' GROUP BY ma_sequence.ma_processplan_version_id, ma_sequenceproduct.m_product_id) sp2 WHERE ma_processplan.ma_processplan_id = ma_processplan_version.ma_processplan_id AND m_product.ma_processplan_id = ma_processplan_version.ma_processplan_id AND ma_processplan.isactive = 'Y' AND ma_processplan_version.isactive = 'Y' AND ma_processplan_version.datefrom <= now() AND ma_processplan_version.dateto > now() AND ma_processplan_version.ma_processplan_version_id = sp1.ma_processplan_version_id AND ma_processplan_version.ma_processplan_version_id = sp2.ma_processplan_version_id AND sp1.m_product_id = m_product.m_product_id AND sp2.m_product_id <> m_product.m_product_id AND sp1.qty > 0 AND sp2.qty <> 0]]></view>
   </database>
--- a/src-db/database/model/views/MA_SEQUENCE_EMPLOYEE_COST.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/MA_SEQUENCE_EMPLOYEE_COST.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,17 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW MA_SEQUENCE_EMPLOYEE_COST">
-    <view name="MA_SEQUENCE_EMPLOYEE_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id, 
-CASE c_salary_category_cost.costuom
-WHEN 'H' THEN ma_sequence.costcenteruse * c_salary_category_cost.cost
-WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * c_salary_category_cost.cost
-WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * c_salary_category_cost.cost
-ELSE NULL
-END AS cost
-FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version, ma_costcenter_employee, c_salary_category_cost, m_product, ma_sequenceproduct
-WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_employee.ma_costcenter_version_id AND ma_costcenter_employee.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max
-FROM ma_costcenter_version ccv
-WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND c_salary_category_cost.datefrom = ((SELECT max(sc.datefrom) AS max
-FROM c_salary_category_cost sc
-WHERE sc.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND sc.datefrom <= ma_processplan_version.datefrom))
-GROUP BY ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id, c_salary_category_cost.cost, c_salary_category_cost.costuom, ma_sequence.costcenteruse]]></view>
+    <view name="MA_SEQUENCE_EMPLOYEE_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id,  CASE c_salary_category_cost.costuom WHEN 'H' THEN ma_sequence.costcenteruse * c_salary_category_cost.cost WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * c_salary_category_cost.cost WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * c_salary_category_cost.cost ELSE NULL END AS cost FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version,  ma_costcenter_employee, c_salary_category_cost, m_product,  ma_sequenceproduct WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_employee.ma_costcenter_version_id AND ma_costcenter_employee.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max FROM ma_costcenter_version ccv WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND c_salary_category_cost.datefrom = ((SELECT max(sc.datefrom) AS max FROM c_salary_category_cost sc WHERE sc.c_salary_category_id = c_salary_category_cost.c_salary_category_id AND sc.datefrom <= ma_processplan_version.datefrom)) GROUP BY ma_sequence.ma_sequence_id, c_salary_category_cost.c_salary_category_id, c_salary_category_cost.cost, c_salary_category_cost.costuom, ma_sequence.costcenteruse]]></view>
   </database>
--- a/src-db/database/model/views/MA_SEQUENCE_INDIRECT_COST_COST.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/MA_SEQUENCE_INDIRECT_COST_COST.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,17 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW MA_SEQUENCE_INDIRECT_COST_COST">
-    <view name="MA_SEQUENCE_INDIRECT_COST_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, ma_indirect_cost_value.ma_indirect_cost_id, 
-CASE ma_indirect_cost_value.cost_uom
-WHEN 'H' THEN ma_sequence.costcenteruse * ma_indirect_cost_value.cost
-WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * ma_indirect_cost_value.cost
-WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * ma_indirect_cost_value.cost
-ELSE NULL
-END AS cost
-FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version, ma_costcenter_ic, ma_indirect_cost_value, m_product, ma_sequenceproduct
-WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_ic.ma_costcenter_version_id AND ma_costcenter_ic.ma_indirect_cost_id = ma_indirect_cost_value.ma_indirect_cost_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_indirect_cost_value.cost_uom <> 'P' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max
-FROM ma_costcenter_version ccv
-WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND ma_indirect_cost_value.datefrom = ((SELECT max(sc.datefrom) AS max
-FROM ma_indirect_cost_value sc
-WHERE sc.ma_indirect_cost_id = ma_indirect_cost_value.ma_indirect_cost_id AND sc.datefrom <= ma_processplan_version.datefrom))
-GROUP BY ma_sequence.ma_sequence_id, ma_indirect_cost_value.ma_indirect_cost_id, ma_indirect_cost_value.cost, ma_indirect_cost_value.cost_uom, ma_sequence.costcenteruse]]></view>
+    <view name="MA_SEQUENCE_INDIRECT_COST_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, ma_indirect_cost_value.ma_indirect_cost_id,  CASE ma_indirect_cost_value.cost_uom WHEN 'H' THEN ma_sequence.costcenteruse * ma_indirect_cost_value.cost WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * ma_indirect_cost_value.cost WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * ma_indirect_cost_value.cost ELSE NULL END AS cost FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version,  ma_costcenter_ic, ma_indirect_cost_value, m_product, ma_sequenceproduct WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_ic.ma_costcenter_version_id AND ma_costcenter_ic.ma_indirect_cost_id = ma_indirect_cost_value.ma_indirect_cost_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_indirect_cost_value.cost_uom <> 'P' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max FROM ma_costcenter_version ccv WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND ma_indirect_cost_value.datefrom = ((SELECT max(sc.datefrom) AS max FROM ma_indirect_cost_value sc WHERE sc.ma_indirect_cost_id = ma_indirect_cost_value.ma_indirect_cost_id AND sc.datefrom <= ma_processplan_version.datefrom)) GROUP BY ma_sequence.ma_sequence_id, ma_indirect_cost_value.ma_indirect_cost_id, ma_indirect_cost_value.cost, ma_indirect_cost_value.cost_uom, ma_sequence.costcenteruse]]></view>
   </database>
--- a/src-db/database/model/views/MA_SEQUENCE_MACHINE_COST.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/MA_SEQUENCE_MACHINE_COST.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,17 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW MA_SEQUENCE_MACHINE_COST">
-    <view name="MA_SEQUENCE_MACHINE_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, ma_machine_cost.ma_machine_id, 
-CASE ma_machine_cost.costuom
-WHEN 'H' THEN ma_sequence.costcenteruse * ma_machine_cost.cost
-WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * ma_machine_cost.cost
-WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * ma_machine_cost.cost
-ELSE NULL
-END AS cost
-FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version, ma_costcenter_machine, ma_machine_cost, m_product, ma_sequenceproduct
-WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_machine.ma_costcenter_version_id AND ma_costcenter_machine.ma_machine_id = ma_machine_cost.ma_machine_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max
-FROM ma_costcenter_version ccv
-WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND ma_machine_cost.validfrom = ((SELECT max(mc.validfrom) AS max
-FROM ma_machine_cost mc
-WHERE mc.ma_machine_id = ma_machine_cost.ma_machine_id AND mc.validfrom <= ma_processplan_version.datefrom))
-GROUP BY ma_sequence.ma_sequence_id, ma_machine_cost.ma_machine_id, ma_machine_cost.cost, ma_machine_cost.costuom, ma_sequence.costcenteruse]]></view>
+    <view name="MA_SEQUENCE_MACHINE_COST"><![CDATA[SELECT ma_sequence.ma_sequence_id, ma_machine_cost.ma_machine_id,  CASE ma_machine_cost.costuom WHEN 'H' THEN ma_sequence.costcenteruse * ma_machine_cost.cost WHEN 'U' THEN sum(ma_sequenceproduct.quantity) * ma_machine_cost.cost WHEN 'K' THEN sum(ma_sequenceproduct.quantity * m_product.weight) * ma_machine_cost.cost ELSE NULL END AS cost FROM ma_sequence, ma_process, ma_processplan_version, ma_costcenter_version,  ma_costcenter_machine, ma_machine_cost, m_product, ma_sequenceproduct WHERE ma_sequence.ma_process_id = ma_process.ma_process_id AND ma_sequence.ma_processplan_version_id = ma_processplan_version.ma_processplan_version_id AND ma_process.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ma_costcenter_version.ma_costcenter_version_id = ma_costcenter_machine.ma_costcenter_version_id AND ma_costcenter_machine.ma_machine_id = ma_machine_cost.ma_machine_id AND ma_sequence.ma_sequence_id = ma_sequenceproduct.ma_sequence_id AND ma_sequenceproduct.m_product_id = m_product.m_product_id AND ma_sequenceproduct.productiontype = '+' AND ma_costcenter_version.validfrom = ((SELECT max(ccv.validfrom) AS max FROM ma_costcenter_version ccv WHERE ccv.ma_costcenter_id = ma_costcenter_version.ma_costcenter_id AND ccv.validfrom <= ma_processplan_version.datefrom)) AND ma_machine_cost.validfrom = ((SELECT max(mc.validfrom) AS max FROM ma_machine_cost mc WHERE mc.ma_machine_id = ma_machine_cost.ma_machine_id AND mc.validfrom <= ma_processplan_version.datefrom)) GROUP BY ma_sequence.ma_sequence_id, ma_machine_cost.ma_machine_id, ma_machine_cost.cost, ma_machine_cost.costuom, ma_sequence.costcenteruse]]></view>
   </database>
--- a/src-db/database/model/views/M_INOUT_CANDIDATE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/M_INOUT_CANDIDATE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,10 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_INOUT_CANDIDATE_V">
-    <view name="M_INOUT_CANDIDATE_V"><![CDATA[SELECT o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines AS amountlines, sum((l.qtyordered - l.qtydelivered) * l.priceactual) AS totallines
-FROM c_order o
-JOIN c_orderline l ON o.c_order_id = l.c_order_id
-WHERE o.docstatus = 'CO' AND o.isdelivered = 'N' AND (o.c_doctype_id IN (SELECT c_doctype.c_doctype_id
-FROM c_doctype
-WHERE c_doctype.docbasetype = 'SOO' AND (c_doctype.docsubtypeso NOT IN ('ON', 'OB', 'WR')))) AND l.qtyordered <> l.qtydelivered AND l.directship = 'N' AND l.m_product_id IS NOT NULL
-GROUP BY o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.totallines, o.c_doctype_id]]></view>
+    <view name="M_INOUT_CANDIDATE_V"><![CDATA[SELECT o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id,  o.documentno, o.dateordered, o.c_doctype_id, o.totallines AS amountlines,  sum((l.qtyordered - l.qtydelivered) * l.priceactual) AS totallines FROM c_order o JOIN c_orderline l ON o.c_order_id = l.c_order_id WHERE o.docstatus = 'CO' AND o.isdelivered = 'N' AND (o.c_doctype_id IN (SELECT c_doctype.c_doctype_id FROM c_doctype WHERE c_doctype.docbasetype = 'SOO' AND (c_doctype.docsubtypeso NOT IN ('ON', 'OB', 'WR')))) AND l.qtyordered <> l.qtydelivered AND l.directship = 'N' AND l.m_product_id IS NOT NULL GROUP BY o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.totallines, o.c_doctype_id]]></view>
   </database>
--- a/src-db/database/model/views/M_INOUT_HEADER_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/M_INOUT_HEADER_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,13 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_INOUT_HEADER_V">
-    <view name="M_INOUT_HEADER_V"><![CDATA[SELECT io.ad_client_id, io.ad_org_id, io.isactive, io.created, io.createdby, io.updated, io.updatedby, to_char('en_US') AS ad_language, io.m_inout_id, io.issotrx, io.documentno, io.docstatus, io.c_doctype_id, io.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid, io.m_warehouse_id, wh.c_location_id AS warehouse_location_id, dt.printname AS documenttype, dt.documentnote AS documenttypenote, io.c_order_id, io.movementdate, io.movementtype, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, io.description, io.poreference, io.dateordered, io.m_shipper_id, io.deliveryrule, io.deliveryviarule, io.priorityrule
-FROM m_inout io
-JOIN c_doctype dt ON io.c_doctype_id = dt.c_doctype_id
-JOIN c_bpartner bp ON io.c_bpartner_id = bp.c_bpartner_id
-LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id
-JOIN c_bpartner_location bpl ON io.c_bpartner_location_id = bpl.c_bpartner_location_id
-LEFT JOIN ad_user bpc ON io.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id
-JOIN ad_orginfo oi ON io.ad_org_id = oi.ad_org_id
-JOIN m_warehouse wh ON io.m_warehouse_id = wh.m_warehouse_id]]></view>
+    <view name="M_INOUT_HEADER_V"><![CDATA[SELECT io.ad_client_id, io.ad_org_id, io.isactive, io.created, io.createdby,  io.updated, io.updatedby, to_char('en_US') AS ad_language,  io.m_inout_id, io.issotrx, io.documentno, io.docstatus, io.c_doctype_id,  io.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id,  oi.taxid, io.m_warehouse_id, wh.c_location_id AS warehouse_location_id,  dt.printname AS documenttype, dt.documentnote AS documenttypenote,  io.c_order_id, io.movementdate, io.movementtype, bpg.name AS bpgreeting,  bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, io.description, io.poreference, io.dateordered,  io.m_shipper_id, io.deliveryrule, io.deliveryviarule, io.priorityrule FROM m_inout io JOIN c_doctype dt ON io.c_doctype_id = dt.c_doctype_id JOIN c_bpartner bp ON io.c_bpartner_id = bp.c_bpartner_id LEFT JOIN c_greeting bpg ON bp.c_greeting_id = bpg.c_greeting_id JOIN c_bpartner_location bpl ON io.c_bpartner_location_id = bpl.c_bpartner_location_id LEFT JOIN ad_user bpc ON io.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id JOIN ad_orginfo oi ON io.ad_org_id = oi.ad_org_id JOIN m_warehouse wh ON io.m_warehouse_id = wh.m_warehouse_id]]></view>
   </database>
--- a/src-db/database/model/views/M_INOUT_HEADER_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/M_INOUT_HEADER_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,13 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_INOUT_HEADER_VT">
-    <view name="M_INOUT_HEADER_VT"><![CDATA[SELECT io.ad_client_id, io.ad_org_id, io.isactive, io.created, io.createdby, io.updated, io.updatedby, dt.ad_language, io.m_inout_id, io.issotrx, io.documentno, io.docstatus, io.c_doctype_id, io.c_bpartner_id, bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid, io.m_warehouse_id, wh.c_location_id AS warehouse_location_id, dt.printname AS documenttype, dt.documentnote AS documenttypenote, io.c_order_id, io.movementdate, io.movementtype, bpg.name AS bpgreeting, bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title, NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id, bp.referenceno, io.description, io.poreference, io.dateordered, io.m_shipper_id, io.deliveryrule, io.deliveryviarule, io.priorityrule
-FROM m_inout io
-JOIN c_doctype_trl dt ON io.c_doctype_id = dt.c_doctype_id
-JOIN c_bpartner bp ON io.c_bpartner_id = bp.c_bpartner_id
-LEFT JOIN c_greeting_trl bpg ON bp.c_greeting_id = bpg.c_greeting_id AND dt.ad_language = bpg.ad_language
-JOIN c_bpartner_location bpl ON io.c_bpartner_location_id = bpl.c_bpartner_location_id
-LEFT JOIN ad_user bpc ON io.ad_user_id = bpc.ad_user_id
-LEFT JOIN c_greeting_trl bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id AND dt.ad_language = bpcg.ad_language
-JOIN ad_orginfo oi ON io.ad_org_id = oi.ad_org_id
-JOIN m_warehouse wh ON io.m_warehouse_id = wh.m_warehouse_id]]></view>
+    <view name="M_INOUT_HEADER_VT"><![CDATA[SELECT io.ad_client_id, io.ad_org_id, io.isactive, io.created, io.createdby,  io.updated, io.updatedby, dt.ad_language, io.m_inout_id, io.issotrx,  io.documentno, io.docstatus, io.c_doctype_id, io.c_bpartner_id,  bp.value AS bpvalue, oi.c_location_id AS org_location_id, oi.taxid,  io.m_warehouse_id, wh.c_location_id AS warehouse_location_id,  dt.printname AS documenttype, dt.documentnote AS documenttypenote,  io.c_order_id, io.movementdate, io.movementtype, bpg.name AS bpgreeting,  bp.name, bp.name2, bpcg.name AS bpcontactgreeting, bpc.title,  NULLIF(bpc.name, bp.name) AS contactname, bpl.c_location_id,  bp.referenceno, io.description, io.poreference, io.dateordered,  io.m_shipper_id, io.deliveryrule, io.deliveryviarule, io.priorityrule FROM m_inout io JOIN c_doctype_trl dt ON io.c_doctype_id = dt.c_doctype_id JOIN c_bpartner bp ON io.c_bpartner_id = bp.c_bpartner_id LEFT JOIN c_greeting_trl bpg ON bp.c_greeting_id = bpg.c_greeting_id AND dt.ad_language = bpg.ad_language JOIN c_bpartner_location bpl ON io.c_bpartner_location_id = bpl.c_bpartner_location_id LEFT JOIN ad_user bpc ON io.ad_user_id = bpc.ad_user_id LEFT JOIN c_greeting_trl bpcg ON bpc.c_greeting_id = bpcg.c_greeting_id AND dt.ad_language = bpcg.ad_language JOIN ad_orginfo oi ON io.ad_org_id = oi.ad_org_id JOIN m_warehouse wh ON io.m_warehouse_id = wh.m_warehouse_id]]></view>
   </database>
--- a/src-db/database/model/views/M_INOUT_LINE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/M_INOUT_LINE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,18 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_INOUT_LINE_V">
-    <view name="M_INOUT_LINE_V"><![CDATA[SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.movementqty, uom.uomsymbol, COALESCE(p.name, iol.description) AS name, 
-CASE
-WHEN p.name IS NOT NULL THEN iol.description
-ELSE NULL
-END AS description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
-FROM m_inoutline iol
-JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id
-LEFT JOIN m_product p ON iol.m_product_id = p.m_product_id
-UNION 
-SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, 'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line + b.line / 100 AS line, iol.movementqty * b.bomqty AS movementqty, uom.uomsymbol, p.name, b.description, p.documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
-FROM m_product_bom b
-JOIN m_inoutline iol ON b.m_product_id = iol.m_product_id
-JOIN m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.ispicklistprintdetails = 'Y'
-JOIN m_product p ON b.m_productbom_id = p.m_product_id
-JOIN c_uom uom ON p.c_uom_id = uom.c_uom_id]]></view>
+    <view name="M_INOUT_LINE_V"><![CDATA[SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created,  iol.createdby, iol.updated, iol.updatedby,  'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id,  iol.line, iol.movementqty, uom.uomsymbol,  COALESCE(p.name, iol.description) AS name,  CASE WHEN p.name IS NOT NULL THEN iol.description ELSE NULL END AS description,  p.documentnote, p.upc, p.sku, p.value AS productvalue,  iol.m_locator_id FROM m_inoutline iol JOIN c_uom uom ON iol.c_uom_id = uom.c_uom_id LEFT JOIN m_product p ON iol.m_product_id = p.m_product_id UNION  SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created,  iol.createdby, iol.updated, iol.updatedby,  'en_US' AS ad_language, iol.m_inout_id, iol.m_inoutline_id,  iol.line + b.line / 100 AS line,  iol.movementqty * b.bomqty AS movementqty, uom.uomsymbol, p.name,  b.description, p.documentnote, p.upc, p.sku,  p.value AS productvalue, iol.m_locator_id FROM m_product_bom b JOIN m_inoutline iol ON b.m_product_id = iol.m_product_id JOIN m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.ispicklistprintdetails = 'Y' JOIN m_product p ON b.m_productbom_id = p.m_product_id JOIN c_uom uom ON p.c_uom_id = uom.c_uom_id]]></view>
   </database>
--- a/src-db/database/model/views/M_INOUT_LINE_VT.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/M_INOUT_LINE_VT.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,20 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_INOUT_LINE_VT">
-    <view name="M_INOUT_LINE_VT"><![CDATA[SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.movementqty, uom.uomsymbol, COALESCE(COALESCE(pt.name, p.name), iol.description) AS name, 
-CASE
-WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN iol.description
-ELSE NULL
-END AS description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
-FROM m_inoutline iol
-JOIN c_uom_trl uom ON iol.c_uom_id = uom.c_uom_id
-LEFT JOIN m_product p ON iol.m_product_id = p.m_product_id
-LEFT JOIN m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language
-UNION 
-SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created, iol.createdby, iol.updated, iol.updatedby, uom.ad_language, iol.m_inout_id, iol.m_inoutline_id, iol.line + b.line / 100 AS line, iol.movementqty * b.bomqty AS movementqty, uom.uomsymbol, COALESCE(pt.name, p.name) AS name, b.description, COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc, p.sku, p.value AS productvalue, iol.m_locator_id
-FROM m_product_bom b
-JOIN m_inoutline iol ON b.m_product_id = iol.m_product_id
-JOIN m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.ispicklistprintdetails = 'Y'
-JOIN m_product p ON b.m_productbom_id = p.m_product_id
-JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id
-JOIN m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language]]></view>
+    <view name="M_INOUT_LINE_VT"><![CDATA[SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created,  iol.createdby, iol.updated, iol.updatedby, uom.ad_language,  iol.m_inout_id, iol.m_inoutline_id, iol.line, iol.movementqty,  uom.uomsymbol,  COALESCE(COALESCE(pt.name, p.name), iol.description) AS name,  CASE WHEN COALESCE(pt.name, p.name) IS NOT NULL THEN iol.description ELSE NULL END AS description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc,  p.sku, p.value AS productvalue, iol.m_locator_id FROM m_inoutline iol JOIN c_uom_trl uom ON iol.c_uom_id = uom.c_uom_id LEFT JOIN m_product p ON iol.m_product_id = p.m_product_id LEFT JOIN m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language UNION  SELECT iol.ad_client_id, iol.ad_org_id, iol.isactive, iol.created,  iol.createdby, iol.updated, iol.updatedby, uom.ad_language,  iol.m_inout_id, iol.m_inoutline_id,  iol.line + b.line / 100 AS line,  iol.movementqty * b.bomqty AS movementqty, uom.uomsymbol,  COALESCE(pt.name, p.name) AS name, b.description,  COALESCE(pt.documentnote, p.documentnote) AS documentnote, p.upc,  p.sku, p.value AS productvalue, iol.m_locator_id FROM m_product_bom b JOIN m_inoutline iol ON b.m_product_id = iol.m_product_id JOIN m_product bp ON bp.m_product_id = iol.m_product_id AND bp.isbom = 'Y' AND bp.isverified = 'Y' AND bp.ispicklistprintdetails = 'Y' JOIN m_product p ON b.m_productbom_id = p.m_product_id JOIN c_uom_trl uom ON p.c_uom_id = uom.c_uom_id JOIN m_product_trl pt ON iol.m_product_id = pt.m_product_id AND uom.ad_language = pt.ad_language]]></view>
   </database>
--- a/src-db/database/model/views/M_TRANSACTION_SUM.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/M_TRANSACTION_SUM.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,7 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_TRANSACTION_SUM">
-    <view name="M_TRANSACTION_SUM"><![CDATA[SELECT t.ad_client_id, t.ad_org_id, t.movementtype, l.m_warehouse_id, t.m_locator_id, t.m_product_id, t.movementdate, sum(t.movementqty) AS movementqty
-FROM m_transaction t, m_locator l
-WHERE t.m_locator_id = l.m_locator_id
-GROUP BY t.ad_client_id, t.ad_org_id, t.movementtype, l.m_warehouse_id, t.m_locator_id, t.m_product_id, t.movementdate]]></view>
+    <view name="M_TRANSACTION_SUM"><![CDATA[SELECT t.ad_client_id, t.ad_org_id, t.movementtype, l.m_warehouse_id,  t.m_locator_id, t.m_product_id, t.movementdate,  sum(t.movementqty) AS movementqty FROM m_transaction t, m_locator l WHERE t.m_locator_id = l.m_locator_id GROUP BY t.ad_client_id, t.ad_org_id, t.movementtype, l.m_warehouse_id, t.m_locator_id, t.m_product_id, t.movementdate]]></view>
   </database>
--- a/src-db/database/model/views/M_TRANSACTION_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/M_TRANSACTION_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_TRANSACTION_V">
-    <view name="M_TRANSACTION_V"><![CDATA[SELECT t.ad_client_id, t.ad_org_id, t.movementdate, t.movementqty, t.m_product_id, t.m_locator_id, p.m_product_category_id, p.value, po.c_bpartner_id, po.pricepo, po.pricelastpo, po.pricelist
-FROM m_transaction t, m_product p, m_product_po po
-WHERE t.m_product_id = p.m_product_id AND t.m_product_id = po.m_product_id AND po.iscurrentvendor = 'Y']]></view>
+    <view name="M_TRANSACTION_V"><![CDATA[SELECT t.ad_client_id, t.ad_org_id, t.movementdate, t.movementqty,  t.m_product_id, t.m_locator_id, p.m_product_category_id, p.value,  po.c_bpartner_id, po.pricepo, po.pricelastpo, po.pricelist FROM m_transaction t, m_product p, m_product_po po WHERE t.m_product_id = p.m_product_id AND t.m_product_id = po.m_product_id AND po.iscurrentvendor = 'Y']]></view>
   </database>
--- a/src-db/database/model/views/R_REQUEST_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/R_REQUEST_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,6 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW R_REQUEST_V">
-    <view name="R_REQUEST_V"><![CDATA[SELECT r_request.r_request_id, r_request.ad_client_id, r_request.ad_org_id, r_request.isactive, r_request.created, r_request.createdby, r_request.updated, r_request.updatedby, r_request.documentno, r_request.requestamt, r_request.priority, r_request.duetype, r_request.summary, r_request.isescalated, r_request.datelastaction, r_request.lastresult, r_request.ad_user_id, r_request.c_bpartner_id, r_request.c_campaign_id, r_request.c_order_id, r_request.c_invoice_id, r_request.c_debt_payment_id, r_request.m_product_id, r_request.c_project_id, r_request.actiontype, r_request.r_mailtext_id, r_request.mailsubject, r_request.mailtext, r_request.result, r_request.nextaction, r_request.datenextaction, r_request.processing, r_request.processed, r_request.r_requesttype_id, r_request.salesrep_id, r_request.isselfservice
-FROM r_request
-WHERE r_request.isactive = 'Y' AND r_request.processed = 'N' AND now() > r_request.datenextaction]]></view>
+    <view name="R_REQUEST_V"><![CDATA[SELECT r_request.r_request_id, r_request.ad_client_id, r_request.ad_org_id,  r_request.isactive, r_request.created, r_request.createdby,  r_request.updated, r_request.updatedby, r_request.documentno,  r_request.requestamt, r_request.priority, r_request.duetype,  r_request.summary, r_request.isescalated, r_request.datelastaction,  r_request.lastresult, r_request.ad_user_id, r_request.c_bpartner_id,  r_request.c_campaign_id, r_request.c_order_id, r_request.c_invoice_id,  r_request.c_debt_payment_id, r_request.m_product_id, r_request.c_project_id,  r_request.actiontype, r_request.r_mailtext_id, r_request.mailsubject,  r_request.mailtext, r_request.result, r_request.nextaction,  r_request.datenextaction, r_request.processing, r_request.processed,  r_request.r_requesttype_id, r_request.salesrep_id, r_request.isselfservice FROM r_request WHERE r_request.isactive = 'Y' AND r_request.processed = 'N' AND now() > r_request.datenextaction]]></view>
   </database>
--- a/src-db/database/model/views/S_TIMEEXPENSELINE_V.xml	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-db/database/model/views/S_TIMEEXPENSELINE_V.xml	Mon Feb 04 09:27:53 2013 +0100
@@ -1,7 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW S_TIMEEXPENSELINE_V">
-    <view name="S_TIMEEXPENSELINE_V"><![CDATA[SELECT tel.s_timeexpenseline_id, tel.ad_client_id, tel.ad_org_id, tel.isactive, tel.created, tel.createdby, tel.updated, tel.updatedby, tel.s_timeexpense_id, tel.line, tel.istimereport, te.datereport, tel.m_product_id, tel.qty, tel.expenseamt, tel.c_currency_id, tel.convertedamt, tel.s_resourceassignment_id, tel.description, tel.note, tel.isinvoiced, tel.c_project_id, tel.c_activity_id, tel.c_campaign_id, tel.c_invoiceline_id, tel.invoiceprice, tel.c_uom_id, tel.c_orderline_id, tel.c_projectphase_id, tel.c_projecttask_id, tel.s_timetype_id, te.c_bpartner_id, tel.dateexpense, tel.c_bpartner_id AS tel_c_bpartner_id
-FROM s_timeexpenseline tel
-JOIN s_timeexpense te ON tel.s_timeexpense_id = te.s_timeexpense_id
-WHERE tel.qty <> 0 AND tel.c_invoiceline_id IS NULL AND te.processed = 'Y' AND tel.isactive = 'Y' AND te.isactive = 'Y' AND tel.istimereport <> 'Y']]></view>
+    <view name="S_TIMEEXPENSELINE_V"><![CDATA[SELECT tel.s_timeexpenseline_id, tel.ad_client_id, tel.ad_org_id, tel.isactive,  tel.created, tel.createdby, tel.updated, tel.updatedby,  tel.s_timeexpense_id, tel.line, tel.istimereport, te.datereport,  tel.m_product_id, tel.qty, tel.expenseamt, tel.c_currency_id,  tel.convertedamt, tel.s_resourceassignment_id, tel.description, tel.note,  tel.isinvoiced, tel.c_project_id, tel.c_activity_id, tel.c_campaign_id,  tel.c_invoiceline_id, tel.invoiceprice, tel.c_uom_id, tel.c_orderline_id,  tel.c_projectphase_id, tel.c_projecttask_id, tel.s_timetype_id,  te.c_bpartner_id, tel.dateexpense, tel.c_bpartner_id AS tel_c_bpartner_id FROM s_timeexpenseline tel JOIN s_timeexpense te ON tel.s_timeexpense_id = te.s_timeexpense_id WHERE tel.qty <> 0 AND tel.c_invoiceline_id IS NULL AND te.processed = 'Y' AND tel.isactive = 'Y' AND te.isactive = 'Y' AND tel.istimereport <> 'Y']]></view>
   </database>
--- a/src-wad/src/org/openbravo/wad/Fields_data.xsql	Thu Jan 24 13:16:12 2013 +0100
+++ b/src-wad/src/org/openbravo/wad/Fields_data.xsql	Mon Feb 04 09:27:53 2013 +0100
@@ -28,7 +28,7 @@
       SELECT ad_column.ad_column_id as adColumnId, ad_column.ColumnName as realName, ad_column.ColumnName As Name, '' as NameRef, 
         'x' as xmltext, ad_reference_id as reference, ad_reference_value_id as referencevalue,
         ismandatory as required, (CASE ad_field.isActive WHEN 'N' THEN 'N' ELSE isDisplayed END) as isdisplayed, isupdateable as isupdateable,
-        REPLACE(REPLACE(ad_column.defaultvalue, CHR(13), '\\n'), CHR(10), '') As defaultValue, 
+        REPLACE(ad_column.defaultvalue, CHR(10), '') As defaultValue, 
         ad_column.fieldlength As fieldLength, 
         'Medio' as Text_Align, '' AS Xml_Format, 
         ad_field.displaylength, REPLACE(replace(REPLACE(REPLACE(AD_ELEMENT.columnname, 'Substitute_ID', 'M_Product_ID'), 'C_Settlement_Cancel_ID', 'C_Settlement_ID'), 'BOM_ID', '_ID'), 'M_LocatorTo_ID', 'M_Locator_ID') as columnname, 
@@ -270,7 +270,7 @@
       <![CDATA[
       SELECT ad_column.AD_COLUMN_ID as adColumnId, ad_column.ISMANDATORY as required, 
       REPLACE(replace(REPLACE(REPLACE(columnname, 'Substitute_ID', 'M_Product_ID'), 'C_Settlement_Cancel_ID', 'C_Settlement_ID'), 'BOM_ID', '_ID'), 'M_LocatorTo_ID', 'M_Locator_ID') as Name, 
-      REPLACE(REPLACE(ad_column.defaultvalue, CHR(13), '\\n'), CHR(10), '') as defaultValue, '' as WHERECLAUSE, 
+      REPLACE(ad_column.defaultvalue, CHR(10), '') as defaultValue, '' as WHERECLAUSE, 
       ad_reference_id as reference,
       isdisplayed, ad_column.columnname as columnname, ad_table.ACCESSLEVEL, 
       ad_table.TABLENAME as NameRef, ad_reference_value_id as referencevalue, ad_column.name as realname
@@ -282,7 +282,7 @@
       union
       SELECT ad_column.AD_COLUMN_ID as reference, ad_column.ISMANDATORY as required, 
       columnname as Name, 
-      REPLACE(REPLACE(ad_column.defaultvalue, CHR(13), '\\n'), CHR(10), '') as defaultValue, '' as WHERECLAUSE, 
+      REPLACE(ad_column.defaultvalue, CHR(10), '') as defaultValue, '' as WHERECLAUSE, 
       ad_reference_id as referencevalue,
       'Y', ad_column.columnname as columnname, ad_table.ACCESSLEVEL, 
       ad_table.TABLENAME as NameRef, ad_reference_value_id as type, ad_column.name as realname