[HGVOL] Merged from PI
authorSandra Huguet <sandra.huguet@openbravo.com>
Wed, 14 Oct 2015 09:43:37 +0200
changeset 27930 8fb2fdfe64f7
parent 27917 ffa9a951cbae (current diff)
parent 27929 cda754dfc560 (diff)
child 27932 e67a510a600a
child 28071 8b394fc00fa0
[HGVOL] Merged from PI
src-db/database/sourcedata/AD_COLUMN.xml
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/GLItemSelectorFilterExpression.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/GLItemSelectorFilterExpression.java	Wed Oct 14 09:43:37 2015 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2015 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,11 +21,14 @@
 
 import java.util.Map;
 
+import org.apache.commons.lang.StringUtils;
 import org.openbravo.client.application.FilterExpression;
 import org.openbravo.client.kernel.RequestContext;
 import org.openbravo.dal.core.OBContext;
+
 import org.openbravo.erpCommon.utility.Utility;
 
+
 public class GLItemSelectorFilterExpression implements FilterExpression {
   final static String FINANCIAL_ACCOUNT_WINDOW = "94EAA455D2644E04AB25D93BE5157B6D";
 
@@ -37,6 +40,9 @@
     StringBuilder whereClause = new StringBuilder();
     String orgId = (String) RequestContext.get().getSession()
         .getAttribute(FINANCIAL_ACCOUNT_WINDOW + "|AD_ORG_ID");
+    if(StringUtils.isEmpty(orgId)) {
+    	orgId = requestMap.get("inpadOrgId");
+    }
     String orgList = Utility.getInStrSet(OBContext.getOBContext()
         .getOrganizationStructureProvider().getNaturalTree(orgId));
     if (!orgList.isEmpty()) {
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js	Wed Oct 07 09:31:15 2015 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js	Wed Oct 14 09:43:37 2015 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -114,7 +114,7 @@
     return false;
   }
 
-  var i, row, allRows = item.grid.data.allRows,
+  var i, row, allRows = item.grid.data.allRows || item.grid.data.localData,
       outstanding = new BigDecimal(String(record.outstanding)),
       paidamount = new BigDecimal(String(record.payment));
 
--- a/src-core/src/org/openbravo/base/ConnectionProviderContextListener.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/src-core/src/org/openbravo/base/ConnectionProviderContextListener.java	Wed Oct 14 09:43:37 2015 +0200
@@ -65,12 +65,12 @@
   }
 
   public static void reloadPool(ServletContext context) throws Exception {
-    ConnectionProvider pool = getPool(context);
-    if (pool instanceof ConnectionProviderImpl) {
+    ConnectionProvider connectionPool = getPool(context);
+    if (connectionPool instanceof ConnectionProviderImpl) {
       ConfigParameters configParameters = ConfigParameters.retrieveFrom(context);
       String strPoolFile = configParameters.getPoolFilePath();
       boolean isRelative = !strPoolFile.startsWith("/") && !strPoolFile.substring(1, 1).equals(":");
-      ((ConnectionProviderImpl) pool).reload(strPoolFile, isRelative, configParameters.strContext);
+      ((ConnectionProviderImpl) connectionPool).reload(strPoolFile, isRelative, configParameters.strContext);
       ;
     }
   }
@@ -112,16 +112,16 @@
     return ("yes".equals(jndiUsage) ? true : false);
   }
 
-  private static void destroyPool(ConnectionProvider pool) {
-    if (pool != null && pool instanceof JNDIConnectionProvider) {
+  private static void destroyPool(ConnectionProvider connectionPool) {
+    if (connectionPool != null && connectionPool instanceof JNDIConnectionProvider) {
       try {
-        ((JNDIConnectionProvider) pool).destroy();
+        ((JNDIConnectionProvider) connectionPool).destroy();
       } catch (Exception e) {
         e.printStackTrace();
       }
-    } else if (pool != null && pool instanceof ConnectionProvider) {
+    } else if (connectionPool != null && connectionPool instanceof ConnectionProvider) {
       try {
-        (pool).destroy();
+        (connectionPool).destroy();
       } catch (Exception e) {
         e.printStackTrace();
       }
--- a/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Wed Oct 07 09:31:15 2015 +0200
+++ b/src-db/database/sourcedata/AD_AUXILIARINPUT.xml	Wed Oct 14 09:43:37 2015 +0200
@@ -2727,6 +2727,17 @@
 <!--8482E2A2C9D74EA592CE8AF25AA9364C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--8482E2A2C9D74EA592CE8AF25AA9364C--></AD_AUXILIARINPUT>
 
+<!--84F7B0BB35814D4DBC674F44358F8B43--><AD_AUXILIARINPUT>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <AD_AUXILIARINPUT_ID><![CDATA[84F7B0BB35814D4DBC674F44358F8B43]]></AD_AUXILIARINPUT_ID>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <AD_TAB_ID><![CDATA[7797C73348324DCBB7F17666F31C87A5]]></AD_TAB_ID>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <NAME><![CDATA[DOCBASETYPE]]></NAME>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <CODE><![CDATA[GLJ]]></CODE>
+<!--84F7B0BB35814D4DBC674F44358F8B43-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--84F7B0BB35814D4DBC674F44358F8B43--></AD_AUXILIARINPUT>
+
 <!--861880FCEE6846A1B6BF4E129EDAF3DD--><AD_AUXILIARINPUT>
 <!--861880FCEE6846A1B6BF4E129EDAF3DD-->  <AD_AUXILIARINPUT_ID><![CDATA[861880FCEE6846A1B6BF4E129EDAF3DD]]></AD_AUXILIARINPUT_ID>
 <!--861880FCEE6846A1B6BF4E129EDAF3DD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -4223,6 +4234,17 @@
 <!--FB4C3FF138DD4B2AB582E7BFBEF5CA7F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FB4C3FF138DD4B2AB582E7BFBEF5CA7F--></AD_AUXILIARINPUT>
 
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB--><AD_AUXILIARINPUT>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <AD_AUXILIARINPUT_ID><![CDATA[FB60FE86511640A5A0CDE3CEF9BD2FAB]]></AD_AUXILIARINPUT_ID>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <AD_TAB_ID><![CDATA[5A6F0ED7230C462BA4010653BA3F816A]]></AD_TAB_ID>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <NAME><![CDATA[DOCBASETYPE]]></NAME>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <CODE><![CDATA[GLJ]]></CODE>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FB60FE86511640A5A0CDE3CEF9BD2FAB--></AD_AUXILIARINPUT>
+
 <!--FD2E6059D8E54E37AC2E32C9320369D7--><AD_AUXILIARINPUT>
 <!--FD2E6059D8E54E37AC2E32C9320369D7-->  <AD_AUXILIARINPUT_ID><![CDATA[FD2E6059D8E54E37AC2E32C9320369D7]]></AD_AUXILIARINPUT_ID>
 <!--FD2E6059D8E54E37AC2E32C9320369D7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed Oct 07 09:31:15 2015 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Oct 14 09:43:37 2015 +0200
@@ -231766,9 +231766,9 @@
 <!--203C2E66223345CDBD2A5391BA5212AA-->  <HELP><![CDATA[The date used as a Reference for the document]]></HELP>
 <!--203C2E66223345CDBD2A5391BA5212AA-->  <COLUMNNAME><![CDATA[Referencedate]]></COLUMNNAME>
 <!--203C2E66223345CDBD2A5391BA5212AA-->  <AD_TABLE_ID><![CDATA[F26CC88DB04946F1A19DF05749C4381F]]></AD_TABLE_ID>
-<!--203C2E66223345CDBD2A5391BA5212AA-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--203C2E66223345CDBD2A5391BA5212AA-->  <AD_REFERENCE_ID><![CDATA[478169542A1747BD942DD70C8B45089C]]></AD_REFERENCE_ID>
 <!--203C2E66223345CDBD2A5391BA5212AA-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
-<!--203C2E66223345CDBD2A5391BA5212AA-->  <DEFAULTVALUE><![CDATA[@#Date@]]></DEFAULTVALUE>
+<!--203C2E66223345CDBD2A5391BA5212AA-->  <DEFAULTVALUE><![CDATA[@Documentdate@]]></DEFAULTVALUE>
 <!--203C2E66223345CDBD2A5391BA5212AA-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--203C2E66223345CDBD2A5391BA5212AA-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--203C2E66223345CDBD2A5391BA5212AA-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
@@ -234001,7 +234001,7 @@
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <NAME><![CDATA[Document date]]></NAME>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <COLUMNNAME><![CDATA[Documentdate]]></COLUMNNAME>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <AD_TABLE_ID><![CDATA[F6B6AD5679FF4A798D2A3D44B232C52C]]></AD_TABLE_ID>
-<!--2A9149F05DDC4F5CBE30066C08579533-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--2A9149F05DDC4F5CBE30066C08579533-->  <AD_REFERENCE_ID><![CDATA[478169542A1747BD942DD70C8B45089C]]></AD_REFERENCE_ID>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <DEFAULTVALUE><![CDATA[@#Date@]]></DEFAULTVALUE>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <ISKEY><![CDATA[N]]></ISKEY>
@@ -234015,7 +234015,7 @@
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <AD_ELEMENT_ID><![CDATA[F9666DCCC70646EC811384E23D8FE498]]></AD_ELEMENT_ID>
-<!--2A9149F05DDC4F5CBE30066C08579533-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--2A9149F05DDC4F5CBE30066C08579533-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--2A9149F05DDC4F5CBE30066C08579533-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Oct 07 09:31:15 2015 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Oct 14 09:43:37 2015 +0200
@@ -21013,6 +21013,18 @@
 <!--7A02413548D945938FC34095E61EB76B-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--7A02413548D945938FC34095E61EB76B--></AD_MESSAGE>
 
+<!--7A16451465404D17A0F266F75AF1B6B0--><AD_MESSAGE>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <AD_MESSAGE_ID><![CDATA[7A16451465404D17A0F266F75AF1B6B0]]></AD_MESSAGE_ID>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <VALUE><![CDATA[CostBackgroundWrongOrganization]]></VALUE>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <MSGTEXT><![CDATA[The Costing Background Process can only be scheduled for a legal entity organization or for any of its ancestors]]></MSGTEXT>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--7A16451465404D17A0F266F75AF1B6B0-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--7A16451465404D17A0F266F75AF1B6B0--></AD_MESSAGE>
+
 <!--7AB33AB8041941FFA6CE201A4217C8DE--><AD_MESSAGE>
 <!--7AB33AB8041941FFA6CE201A4217C8DE-->  <AD_MESSAGE_ID><![CDATA[7AB33AB8041941FFA6CE201A4217C8DE]]></AD_MESSAGE_ID>
 <!--7AB33AB8041941FFA6CE201A4217C8DE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Wed Oct 07 09:31:15 2015 +0200
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Wed Oct 14 09:43:37 2015 +0200
@@ -18381,6 +18381,17 @@
 <!--7FF3469B9A49B90AE040007F01007549-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--7FF3469B9A49B90AE040007F01007549--></AD_TEXTINTERFACES>
 
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28--><AD_TEXTINTERFACES>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <AD_TEXTINTERFACES_ID><![CDATA[80A6CA8DAFBC49C3B64D4E2D09381C28]]></AD_TEXTINTERFACES_ID>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <TEXT><![CDATA[Unit Price]]></TEXT>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesXLS.jrxml]]></FILENAME>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--80A6CA8DAFBC49C3B64D4E2D09381C28--></AD_TEXTINTERFACES>
+
 <!--811C781F0F9B4F13945E02EE4EF47A2E--><AD_TEXTINTERFACES>
 <!--811C781F0F9B4F13945E02EE4EF47A2E-->  <AD_TEXTINTERFACES_ID><![CDATA[811C781F0F9B4F13945E02EE4EF47A2E]]></AD_TEXTINTERFACES_ID>
 <!--811C781F0F9B4F13945E02EE4EF47A2E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -19292,6 +19303,17 @@
 <!--90333AD8F13346419056F038E249A6C4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--90333AD8F13346419056F038E249A6C4--></AD_TEXTINTERFACES>
 
+<!--907ABC375C2D4A2BB73DD09945CD0FAD--><AD_TEXTINTERFACES>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <AD_TEXTINTERFACES_ID><![CDATA[907ABC375C2D4A2BB73DD09945CD0FAD]]></AD_TEXTINTERFACES_ID>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <TEXT><![CDATA[Product Search Key]]></TEXT>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesXLS.jrxml]]></FILENAME>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--907ABC375C2D4A2BB73DD09945CD0FAD--></AD_TEXTINTERFACES>
+
 <!--91C8B575671B7107E040007F0100283A--><AD_TEXTINTERFACES>
 <!--91C8B575671B7107E040007F0100283A-->  <AD_TEXTINTERFACES_ID><![CDATA[91C8B575671B7107E040007F0100283A]]></AD_TEXTINTERFACES_ID>
 <!--91C8B575671B7107E040007F0100283A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -19974,6 +19996,17 @@
 <!--99F8F59FF2304614AA4282ABFAA64A86-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--99F8F59FF2304614AA4282ABFAA64A86--></AD_TEXTINTERFACES>
 
+<!--9A8A37D02CFC4A15ADE40E3656F8785D--><AD_TEXTINTERFACES>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <AD_TEXTINTERFACES_ID><![CDATA[9A8A37D02CFC4A15ADE40E3656F8785D]]></AD_TEXTINTERFACES_ID>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <TEXT><![CDATA[Unit Price]]></TEXT>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesXLS.jrxml]]></FILENAME>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9A8A37D02CFC4A15ADE40E3656F8785D--></AD_TEXTINTERFACES>
+
 <!--9B926CFD21334E8991EF48C89971F139--><AD_TEXTINTERFACES>
 <!--9B926CFD21334E8991EF48C89971F139-->  <AD_TEXTINTERFACES_ID><![CDATA[9B926CFD21334E8991EF48C89971F139]]></AD_TEXTINTERFACES_ID>
 <!--9B926CFD21334E8991EF48C89971F139-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -22174,6 +22207,17 @@
 <!--FABD7427F65B4853B4997065812A3C17-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FABD7427F65B4853B4997065812A3C17--></AD_TEXTINTERFACES>
 
+<!--FABF71E4B9474AE683F42B7AEC070D6E--><AD_TEXTINTERFACES>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <AD_TEXTINTERFACES_ID><![CDATA[FABF71E4B9474AE683F42B7AEC070D6E]]></AD_TEXTINTERFACES_ID>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <TEXT><![CDATA[Product Search Key]]></TEXT>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesXLS.jrxml]]></FILENAME>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--FABF71E4B9474AE683F42B7AEC070D6E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FABF71E4B9474AE683F42B7AEC070D6E--></AD_TEXTINTERFACES>
+
 <!--FB62B1323B604E6CBEDDB554D2E4447F--><AD_TEXTINTERFACES>
 <!--FB62B1323B604E6CBEDDB554D2E4447F-->  <AD_TEXTINTERFACES_ID><![CDATA[FB62B1323B604E6CBEDDB554D2E4447F]]></AD_TEXTINTERFACES_ID>
 <!--FB62B1323B604E6CBEDDB554D2E4447F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/costing/CostAdjustmentUtils.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/costing/CostAdjustmentUtils.java	Wed Oct 14 09:43:37 2015 +0200
@@ -154,6 +154,7 @@
         + MaterialTransaction.PROPERTY_MOVEMENTTYPE);
     where.append("   and trx." + MaterialTransaction.PROPERTY_TRANSACTIONPROCESSDATE
         + " > :crStartDate");
+    where.append("   and trx." + MaterialTransaction.PROPERTY_ISCOSTCALCULATED + " = 'Y' ");
     // If there are more than one trx on the same trx process date filter out those types with less
     // priority and / or higher quantity.
     where.append(" and (");
--- a/src/org/openbravo/costing/CostingBackground.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/costing/CostingBackground.java	Wed Oct 14 09:43:37 2015 +0200
@@ -71,6 +71,10 @@
     int counter = 0, total = 0, batch = 0;
     try {
       OBContext.setAdminMode(false);
+
+      CostingUtils.checkValidOrganization(AD_PROCESS_ID, OBContext.getOBContext()
+          .getCurrentOrganization());
+
       result.setType("Success");
       result.setTitle(OBMessageUtils.messageBD("Success"));
 
--- a/src/org/openbravo/costing/CostingUtils.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/costing/CostingUtils.java	Wed Oct 14 09:43:37 2015 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2012-2014 Openbravo SLU
+ * All portions are Copyright (C) 2012-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -28,6 +28,7 @@
 
 import javax.servlet.ServletException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.hibernate.Query;
 import org.hibernate.criterion.Restrictions;
@@ -583,4 +584,24 @@
     }
     return rule.getStartingDate();
   }
+
+  /**
+   * Throws an OBException when the processId is the CostingBackground and it is being executed by
+   * an organization which has a legal entity as an ancestor.
+   * 
+   * @param processId
+   *          This is the process Id being executed. The method only runs the validation when the
+   *          process ID is equal to CostingBackground.AD_PROCESS_ID
+   * @param scheduledOrg
+   *          the organization that runs the process
+   */
+  public static void checkValidOrganization(final String processId, final Organization scheduledOrg) {
+    if (StringUtils.equals(processId, CostingBackground.AD_PROCESS_ID)) {
+      final Organization legalEntity = OBContext.getOBContext().getOrganizationStructureProvider()
+          .getLegalEntity(scheduledOrg);
+      if (legalEntity != null && !StringUtils.equals(legalEntity.getId(), scheduledOrg.getId())) {
+        throw new OBException(OBMessageUtils.messageBD("CostBackgroundWrongOrganization"));
+      }
+    }
+  }
 }
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_ProductRefDate.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_ProductRefDate.java	Wed Oct 14 09:43:37 2015 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2014 Openbravo SLU
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -59,24 +59,26 @@
       Currency currency = organization.getCurrency() != null ? organization.getCurrency()
           : organization.getClient().getCurrency();
       String dateFormat = OBPropertiesProvider.getInstance().getOpenbravoProperties()
-          .getProperty("dateFormat.java");
+          .getProperty("dateTimeFormat.java");
       SimpleDateFormat outputFormat = new SimpleDateFormat(dateFormat);
 
       referenceDate = outputFormat.parse(info.getStringParameter("inpreferencedate", null));
 
       CostingRule costRule = CostingUtils.getCostDimensionRule(organization, referenceDate);
+      if (costRule.isWarehouseDimension()) {
+        info.addResult("inpiswarehousedimension", "Y");
+      } else {
+        info.addResult("inpiswarehousedimension", "N");
+        info.addResult("inpmWarehouseId", null);
+      }
+
       if (product == null) {
         return;
       }
       costDimensions = CostingUtils.getEmptyDimensions();
-      if (costRule.isWarehouseDimension()) {
-        info.addResult("inpiswarehousedimension", "Y");
-        if (warehouseId != null && !warehouseId.isEmpty()) {
-          Warehouse warehouse = OBDal.getInstance().get(Warehouse.class, warehouseId);
-          costDimensions.put(CostDimension.Warehouse, warehouse);
-        }
-      } else {
-        info.addResult("inpiswarehousedimension", "N");
+      if (costRule.isWarehouseDimension() && warehouseId != null && !warehouseId.isEmpty()) {
+        Warehouse warehouse = OBDal.getInstance().get(Warehouse.class, warehouseId);
+        costDimensions.put(CostDimension.Warehouse, warehouse);
       }
       currentValuedStock = CostAdjustmentUtils.getValuedStockOnMovementDate(product, organization,
           referenceDate, costDimensions, currency, costRule.isBackdatedTransactionsFixed());
--- a/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInvoice.java	Wed Oct 14 09:43:37 2015 +0200
@@ -54,10 +54,6 @@
   DocTax[] m_taxes = null;
   DocLine_FinPaymentSchedule[] m_payments = null;
 
-  public DocLine_FinPaymentSchedule[] getM_payments() {
-    return m_payments;
-  }
-
   DocLine[] p_lines_taxes = null;
 
   boolean isCashVAT = false;
@@ -1406,6 +1402,38 @@
     SeqNo = seqNo;
   }
 
+  public DocLine_FinPaymentSchedule[] getM_payments() {
+    return m_payments;
+  }
+
+  public void setM_payments(DocLine_FinPaymentSchedule[] m_payments) {
+    this.m_payments = m_payments;
+  }
+
+  public DocLine[] getP_lines_taxes() {
+    return p_lines_taxes;
+  }
+
+  public void setP_lines_taxes(DocLine[] p_lines_taxes) {
+    this.p_lines_taxes = p_lines_taxes;
+  }
+
+  public boolean isCashVAT() {
+    return isCashVAT;
+  }
+
+  public void setCashVAT(boolean isCashVAT) {
+    this.isCashVAT = isCashVAT;
+  }
+
+  public String getPrepaymentamt() {
+    return prepaymentamt;
+  }
+
+  public void setPrepaymentamt(String prepaymentamt) {
+    this.prepaymentamt = prepaymentamt;
+  }
+
   /**
    * @return the serialVersionUID
    */
--- a/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR_data.xsql	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesJR_data.xsql	Wed Oct 14 09:43:37 2015 +0200
@@ -37,7 +37,8 @@
       '' AS ORG, '' AS PARTNERGROUP, '' AS PARTNER, '' AS DOCUMENTNO, '' AS INVOICEDATE, '' AS PRODCATEGORY, '' AS PRODUCT, 
       '' AS PROFIT, '' AS MARGIN, '' AS PRICE, '' AS CONTACT, '' AS SALESREP, '' AS PROJECT, '' AS ADDRESS,
       '' AS AMOUNTREF2, '' AS QTYREF2, '' AS WEIGHTREF2, '' AS COSTREF2, '' AS CONVAMOUNTREF2, '' AS CONVCOSTREF2,
-      '' AS AMOUNTREF3, '' AS QTYREF3, '' AS WEIGHTREF3, '' AS COSTREF3, '' AS CONVAMOUNTREF3, '' AS CONVCOSTREF3
+      '' AS AMOUNTREF3, '' AS QTYREF3, '' AS WEIGHTREF3, '' AS COSTREF3, '' AS CONVAMOUNTREF3, '' AS CONVCOSTREF3,
+      '' AS SEARCHKEY, '' AS UNITPRICE     
       FROM (SELECT NIVEL1, NIVEL2, NIVEL3, NIVEL4, NIVEL5, NIVEL6, NIVEL7, NIVEL8, NIVEL9, NIVEL10, 
       SUM(LINENETAMT) AS AMOUNT, SUM(QTYINVOICED) AS QTY, SUM(WEIGHT) AS WEIGHT, SUM(COST) AS COST, 
       SUM(LINENETREF) AS AMOUNTREF, SUM(QTYINVOICEDREF) AS QTYREF, SUM(WEIGHT_REF) AS WEIGHTREF, SUM(COSTREF) AS COSTREF,     	  
@@ -1139,7 +1140,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[
-      SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT, 
+      SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT, SEARCHKEY, UNITPRICE, 
         AMOUNT, COST, (AMOUNT - COST) AS PROFIT, CASE WHEN AMOUNT <> 0 THEN ROUND((100 * (AMOUNT - COST) / AMOUNT), 2) * SIGN(AMOUNT - COST) ELSE 0 END AS MARGIN, 
         WEIGHT, QTY, CONTACT, SALESREP, PROJECT, ADDRESS
         FROM (
@@ -1150,6 +1151,8 @@
             TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())) AS INVOICEDATE, 
             M_PRODUCT_CATEGORY.NAME AS PRODCATEGORY, 
             M_PRODUCT.NAME AS PRODUCT, 
+            M_PRODUCT.VALUE AS SEARCHKEY, 
+            C_CURRENCY_CONVERT(CASE WHEN C_INVOICELINE.QTYINVOICED = 0 THEN 0 ELSE C_INVOICELINE.LINENETAMT/C_INVOICELINE.QTYINVOICED END, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) AS UNITPRICE,
             CASE WHEN C_DOCTYPE.DOCBASETYPE = 'ARC' THEN C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT*-1, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) ELSE C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) END AS AMOUNT,
             CASE WHEN (M_PRODUCT.ISSTOCKED='Y' AND M_PRODUCT.PRODUCTTYPE='I') THEN (CASE WHEN trx.movementqty = 0 THEN 0 ELSE COALESCE(C_CURRENCY_CONVERT_PRECISION (ROUND(trxcost.cost/abs(trx.movementqty)*(CASE WHEN c_doctype.docbasetype = 'ARC' THEN c_invoiceline.qtyinvoiced *- 1 ELSE c_invoiceline.qtyinvoiced END), C_GET_CURRENCY_PRECISION(trxcost.c_currency_id, 'C')), trxcost.c_currency_id,?,trx.movementdate,NULL,trx.ad_client_id,trx.ad_org_id,'C'), 0) END)    ELSE (COALESCE(M_GET_NO_TRX_PRODUCT_COST(M_PRODUCT.M_PRODUCT_ID, C_INVOICE.DATEINVOICED, 'STA', ad_org.ad_org_id, null, C_INVOICE.C_CURRENCY_ID), 0)*(CASE WHEN c_doctype.docbasetype = 'ARC' THEN c_invoiceline.qtyinvoiced *- 1 ELSE c_invoiceline.qtyinvoiced END)) END AS COST,                
             C_INVOICELINE.QTYINVOICED*M_PRODUCT.WEIGHT AS WEIGHT,
@@ -1188,6 +1191,7 @@
     <Parameter name="cCurrencyConv"/>
     <Parameter name="cCurrencyConv"/>
     <Parameter name="cCurrencyConv"/>
+    <Parameter name="cCurrencyConv"/>
     <Parameter name="adOrgId" optional="true" type="replace" after="AND C_INVOICE.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="AND C_INVOICE.AD_CLIENT_ID IN (" text="'7'"/>
     <Parameter name="dateFrom" optional="true" after="AND 1=1"><![CDATA[AND C_INVOICE.DATEINVOICED >= to_date(?)]]></Parameter>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesXLS.jrxml	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceCustomerDimensionalAnalysesXLS.jrxml	Wed Oct 14 09:43:37 2015 +0200
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ReportInvoiceCustomerDimensionalAnalysesXLS" pageWidth="1500" pageHeight="842" orientation="Landscape" columnWidth="1500" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="59be190b-97b3-4951-842b-79d4e9d2d71b">
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ReportInvoiceCustomerDimensionalAnalysesXLS" pageWidth="1800" pageHeight="842" orientation="Landscape" columnWidth="1800" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="59be190b-97b3-4951-842b-79d4e9d2d71b">
 	<property name="ireport.scriptlethandling" value="0"/>
 	<property name="ireport.encoding" value="UTF-8"/>
 	<property name="ireport.zoom" value="1.5"/>
-	<property name="ireport.x" value="0"/>
+	<property name="ireport.x" value="587"/>
 	<property name="ireport.y" value="0"/>
 	<import value="net.sf.jasperreports.engine.*"/>
 	<import value="java.util.*"/>
@@ -66,7 +66,7 @@
 		<defaultValueExpression><![CDATA["dd/MM/yyyy"]]></defaultValueExpression>
 	</parameter>
 	<queryString>
-		<![CDATA[SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT,
+		<![CDATA[SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT, SEARCHKEY, UNITPRICE,
         AMOUNT, COST, (AMOUNT - COST) AS PROFIT, CASE WHEN AMOUNT <> 0 THEN ROUND((100 * (AMOUNT - COST) / AMOUNT), 2) ELSE 0 END AS MARGIN,
         WEIGHT, QTY, CONTACT, SALESREP, PROJECT, ADDRESS
         FROM (
@@ -77,6 +77,8 @@
             TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())) AS INVOICEDATE,
             M_PRODUCT_CATEGORY.NAME AS PRODCATEGORY,
             M_PRODUCT.NAME AS PRODUCT,
+	    M_PRODUCT.VALUE AS SEARCHKEY,
+            CASE WHEN C_INVOICELINE.QTYINVOICED = 0 THEN 0 ELSE C_INVOICELINE.LINENETAMT/C_INVOICELINE.QTYINVOICED END AS UNITPRICE,
             CASE WHEN C_DOCTYPE.DOCBASETYPE = 'ARC' THEN C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT*-1, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) ELSE C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) END AS AMOUNT,
             CASE WHEN (M_PRODUCT.ISSTOCKED='Y' AND M_PRODUCT.PRODUCTTYPE='I') THEN (CASE WHEN trx.movementqty = 0 THEN 0 ELSE COALESCE(C_CURRENCY_CONVERT_PRECISION (ROUND(trxcost.cost/abs(trx.movementqty)*c_invoiceline.qtyinvoiced, C_GET_CURRENCY_PRECISION(trxcost.c_currency_id, 'C')), trxcost.c_currency_id,?,trx.movementdate,NULL,trx.ad_client_id,trx.ad_org_id,'C'), 0) END)    ELSE (COALESCE(M_GET_NO_TRX_PRODUCT_COST(M_PRODUCT.M_PRODUCT_ID, C_INVOICE.DATEINVOICED, 'STA', ad_org.ad_org_id, null, C_INVOICE.C_CURRENCY_ID), 0)*C_INVOICELINE.QTYINVOICED) END AS COST,
             C_INVOICELINE.QTYINVOICED*M_PRODUCT.WEIGHT AS WEIGHT,
@@ -119,12 +121,14 @@
 	<field name="INVOICEDATE" class="java.util.Date"/>
 	<field name="PRODCATEGORY" class="java.lang.String"/>
 	<field name="PRODUCT" class="java.lang.String"/>
+	<field name="SEARCHKEY" class="java.lang.String"/>
+	<field name="UNITPRICE" class="java.math.BigDecimal"/>
+	<field name="QTY" class="java.math.BigDecimal"/>
 	<field name="AMOUNT" class="java.math.BigDecimal"/>
 	<field name="COST" class="java.math.BigDecimal"/>
 	<field name="PROFIT" class="java.math.BigDecimal"/>
 	<field name="MARGIN" class="java.math.BigDecimal"/>
 	<field name="WEIGHT" class="java.math.BigDecimal"/>
-	<field name="QTY" class="java.math.BigDecimal"/>
 	<field name="CONTACT" class="java.lang.String"/>
 	<field name="SALESREP" class="java.lang.String"/>
 	<field name="PROJECT" class="java.lang.String"/>
@@ -229,7 +233,46 @@
 				<text><![CDATA[Product]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-8" style="Detail_Header" x="700" y="0" width="100" height="15" uuid="b03c90c1-ca4b-421c-b3c0-691a98e114f5"/>
+				<reportElement key="element-7-1" style="Detail_Header" x="700" y="0" width="100" height="15"/>
+				<box leftPadding="5" rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#333333"/>
+				</box>
+				<textElement>
+					<font size="8"/>
+				</textElement>
+				<text><![CDATA[Product Search Key]]></text>
+			</staticText>
+			<staticText>
+				<reportElement key="element-7-3" style="Detail_Header" x="800" y="0" width="100" height="15"/>
+				<box leftPadding="5" rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#333333"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<text><![CDATA[Quantity]]></text>
+			</staticText>
+			<staticText>
+				<reportElement key="element-7-2" style="Detail_Header" x="900" y="0" width="100" height="15"/>
+				<box leftPadding="5" rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#333333"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<text><![CDATA[Unit Price]]></text>
+			</staticText>
+			<staticText>
+				<reportElement key="element-8" style="Detail_Header" x="1000" y="0" width="100" height="15" uuid="b03c90c1-ca4b-421c-b3c0-691a98e114f5"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -242,7 +285,7 @@
 				<text><![CDATA[Amount]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-9" style="Detail_Header" x="800" y="0" width="100" height="15" uuid="4723d7ac-6850-430e-a4aa-577e94984f44"/>
+				<reportElement key="element-9" style="Detail_Header" x="1100" y="0" width="100" height="15" uuid="4723d7ac-6850-430e-a4aa-577e94984f44"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -255,7 +298,7 @@
 				<text><![CDATA[Cost]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-10" style="Detail_Header" x="900" y="0" width="100" height="15" uuid="5695ba74-05af-4c6b-8ea4-3a9ef0c6109b"/>
+				<reportElement key="element-10" style="Detail_Header" x="1200" y="0" width="100" height="15" uuid="5695ba74-05af-4c6b-8ea4-3a9ef0c6109b"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -268,7 +311,7 @@
 				<text><![CDATA[Profit]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-11" style="Detail_Header" x="1000" y="0" width="50" height="15" uuid="9f789559-d1de-4a31-80ac-8052c7080088"/>
+				<reportElement key="element-11" style="Detail_Header" x="1300" y="0" width="50" height="15" uuid="9f789559-d1de-4a31-80ac-8052c7080088"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -281,7 +324,7 @@
 				<text><![CDATA[M.%]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-12" style="Detail_Header" x="1050" y="0" width="50" height="15" uuid="209d378a-71bc-48eb-a71a-83c2948f9286"/>
+				<reportElement key="element-12" style="Detail_Header" x="1350" y="0" width="50" height="15" uuid="209d378a-71bc-48eb-a71a-83c2948f9286"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -294,7 +337,7 @@
 				<text><![CDATA[Weight]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-13" style="Detail_Header" x="1100" y="0" width="100" height="15" uuid="b7720fd1-f58b-43af-996f-ce19d09ca9bf"/>
+				<reportElement key="element-13" style="Detail_Header" x="1400" y="0" width="100" height="15" uuid="b7720fd1-f58b-43af-996f-ce19d09ca9bf"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -307,7 +350,7 @@
 				<text><![CDATA[Quantity]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-14" style="Detail_Header" x="1100" y="0" width="100" height="15" uuid="7cdf0b1e-d288-4be0-be37-f0f44e74e6a1"/>
+				<reportElement key="element-14" style="Detail_Header" x="1400" y="0" width="100" height="15" uuid="7cdf0b1e-d288-4be0-be37-f0f44e74e6a1"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -320,7 +363,7 @@
 				<text><![CDATA[Contact]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-15" style="Detail_Header" x="1200" y="0" width="100" height="15" uuid="d40acb18-ce14-465b-9427-c99a5c192c24"/>
+				<reportElement key="element-15" style="Detail_Header" x="1500" y="0" width="100" height="15" uuid="d40acb18-ce14-465b-9427-c99a5c192c24"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -333,7 +376,7 @@
 				<text><![CDATA[Sales rep.]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-16" style="Detail_Header" x="1300" y="0" width="100" height="15" uuid="46e9cfee-0663-4bcc-99e2-559fe0c31be0"/>
+				<reportElement key="element-16" style="Detail_Header" x="1600" y="0" width="100" height="15" uuid="46e9cfee-0663-4bcc-99e2-559fe0c31be0"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -346,7 +389,7 @@
 				<text><![CDATA[Project]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-17" style="Detail_Header" x="1400" y="0" width="100" height="15" uuid="bd9a2711-395d-4ebd-856b-14005795d9d8"/>
+				<reportElement key="element-17" style="Detail_Header" x="1700" y="0" width="100" height="15" uuid="bd9a2711-395d-4ebd-856b-14005795d9d8"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -446,8 +489,21 @@
 				</textElement>
 				<textFieldExpression><![CDATA[$F{PRODUCT}]]></textFieldExpression>
 			</textField>
+			<textField pattern="" isBlankWhenNull="true">
+				<reportElement key="textField-13" stretchType="RelativeToBandHeight" x="800" y="0" width="100" height="13"/>
+				<box rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{QTY}]]></textFieldExpression>
+			</textField>
 			<textField pattern="" isBlankWhenNull="false">
-				<reportElement key="textField-8" stretchType="RelativeToBandHeight" x="700" y="0" width="100" height="13" uuid="09f0aa65-d2eb-4ee4-a68f-a368840c5904"/>
+				<reportElement key="textField-8" stretchType="RelativeToBandHeight" x="1000" y="0" width="100" height="13" uuid="09f0aa65-d2eb-4ee4-a68f-a368840c5904"/>
 				<box rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -460,7 +516,7 @@
 				<textFieldExpression><![CDATA[$F{AMOUNT}]]></textFieldExpression>
 			</textField>
 			<textField pattern="" isBlankWhenNull="false">
-				<reportElement key="textField-9" stretchType="RelativeToBandHeight" x="800" y="0" width="100" height="13" uuid="485e1ead-f9d9-4b7e-9b69-de548e006df9"/>
+				<reportElement key="textField-9" stretchType="RelativeToBandHeight" x="1100" y="0" width="100" height="13" uuid="485e1ead-f9d9-4b7e-9b69-de548e006df9"/>
 				<box rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -473,7 +529,7 @@
 				<textFieldExpression><![CDATA[$F{COST}]]></textFieldExpression>
 			</textField>
 			<textField pattern="" isBlankWhenNull="false">
-				<reportElement key="textField-10" stretchType="RelativeToBandHeight" x="900" y="0" width="100" height="13" uuid="98e73443-30bf-4370-9c33-c03f18722331"/>
+				<reportElement key="textField-10" stretchType="RelativeToBandHeight" x="1200" y="0" width="100" height="13" uuid="98e73443-30bf-4370-9c33-c03f18722331"/>
 				<box rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -486,7 +542,7 @@
 				<textFieldExpression><![CDATA[$F{PROFIT}]]></textFieldExpression>
 			</textField>
 			<textField pattern="" isBlankWhenNull="false">
-				<reportElement key="textField-11" stretchType="RelativeToBandHeight" x="1000" y="0" width="50" height="13" uuid="3d0815a2-b760-434e-bb63-ec856afae135"/>
+				<reportElement key="textField-11" stretchType="RelativeToBandHeight" x="1300" y="0" width="50" height="13" uuid="3d0815a2-b760-434e-bb63-ec856afae135"/>
 				<box rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -499,7 +555,7 @@
 				<textFieldExpression><![CDATA[$F{MARGIN}]]></textFieldExpression>
 			</textField>
 			<textField pattern="" isBlankWhenNull="true">
-				<reportElement key="textField-12" stretchType="RelativeToBandHeight" x="1050" y="0" width="50" height="13" uuid="d9693cbb-9d69-418a-becf-e47130fcc0a3"/>
+				<reportElement key="textField-12" stretchType="RelativeToBandHeight" x="1350" y="0" width="50" height="13" uuid="d9693cbb-9d69-418a-becf-e47130fcc0a3"/>
 				<box rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -511,21 +567,8 @@
 				</textElement>
 				<textFieldExpression><![CDATA[$F{WEIGHT}]]></textFieldExpression>
 			</textField>
-			<textField pattern="" isBlankWhenNull="true">
-				<reportElement key="textField-13" stretchType="RelativeToBandHeight" x="1100" y="0" width="100" height="13" uuid="c77304b6-6c88-4430-843c-33e0463f04e0"/>
-				<box rightPadding="2">
-					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<bottomPen lineWidth="0.0" lineColor="#000000"/>
-					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-				</box>
-				<textElement textAlignment="Right">
-					<font size="8"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$F{QTY}]]></textFieldExpression>
-			</textField>
 			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
-				<reportElement key="textField-14" stretchType="RelativeToBandHeight" x="1100" y="0" width="100" height="13" uuid="79490dd4-4d29-4e5a-9301-aeb669776a2d"/>
+				<reportElement key="textField-14" stretchType="RelativeToBandHeight" x="1400" y="0" width="100" height="13" uuid="79490dd4-4d29-4e5a-9301-aeb669776a2d"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -538,7 +581,7 @@
 				<textFieldExpression><![CDATA[$F{CONTACT}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
-				<reportElement key="textField-15" stretchType="RelativeToBandHeight" x="1200" y="0" width="100" height="13" uuid="bc1efd65-c636-44b1-b917-d996463d5051"/>
+				<reportElement key="textField-15" stretchType="RelativeToBandHeight" x="1500" y="0" width="100" height="13" uuid="bc1efd65-c636-44b1-b917-d996463d5051"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -551,7 +594,7 @@
 				<textFieldExpression><![CDATA[$F{SALESREP}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
-				<reportElement key="textField-16" stretchType="RelativeToBandHeight" x="1300" y="0" width="100" height="13" uuid="6ebe8fea-d158-42b0-858d-92dcd3018570"/>
+				<reportElement key="textField-16" stretchType="RelativeToBandHeight" x="1600" y="0" width="100" height="13" uuid="6ebe8fea-d158-42b0-858d-92dcd3018570"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -564,7 +607,7 @@
 				<textFieldExpression><![CDATA[$F{PROJECT}]]></textFieldExpression>
 			</textField>
 			<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
-				<reportElement key="textField-17" stretchType="RelativeToBandHeight" x="1400" y="0" width="100" height="13" uuid="ba9df64a-1e05-46b2-ae62-7ac93a7698af"/>
+				<reportElement key="textField-17" stretchType="RelativeToBandHeight" x="1700" y="0" width="100" height="13" uuid="ba9df64a-1e05-46b2-ae62-7ac93a7698af"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -576,6 +619,27 @@
 				</textElement>
 				<textFieldExpression><![CDATA[$F{ADDRESS}]]></textFieldExpression>
 			</textField>
+			<textField pattern="" isBlankWhenNull="true">
+				<reportElement key="textField-13" stretchType="RelativeToBandHeight" x="900" y="0" width="100" height="13"/>
+				<box rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{UNITPRICE}]]></textFieldExpression>
+			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement key="textField-7" stretchType="RelativeToBandHeight" x="700" y="0" width="100" height="13"/>
+				<box rightPadding="2"/>
+				<textElement>
+					<font size="8"/>
+				</textElement>
+				<textFieldExpression class="java.lang.String"><![CDATA[$F{SEARCHKEY}]]></textFieldExpression>
+			</textField>
 		</band>
 	</detail>
 	<columnFooter>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesJR_data.xsql	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesJR_data.xsql	Wed Oct 14 09:43:37 2015 +0200
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2014 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2015 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -32,7 +32,8 @@
 	  C_CURRENCY_SYMBOL(?, 0, 'Y') AS CONVSYM,	  	  
 	  C_CURRENCY_ISOSYM(?) AS CONVISOSYM,
 	  '' AS ID, '' AS NAME, '' AS TRANSCURRENCYID, '' AS TRANSDATE, '' AS TRANSCLIENTID, '' AS TRANSORGID,
-      '' AS ORG, '' AS PARTNERGROUP, '' AS PARTNER, '' AS DOCUMENTNO, '' AS INVOICEDATE, '' AS PRODCATEGORY, '' AS PRODUCT
+      '' AS ORG, '' AS PARTNERGROUP, '' AS PARTNER, '' AS DOCUMENTNO, '' AS INVOICEDATE, '' AS PRODCATEGORY, '' AS PRODUCT,
+      '' AS SEARCHKEY, '' AS UNITPRICE
       FROM (SELECT NIVEL1, NIVEL2, NIVEL3, NIVEL4, NIVEL5, 
       SUM(LINENETAMT) AS AMOUNT, SUM(QTYINVOICED) AS QTY,
       SUM(LINENETREF) AS AMOUNTREF, SUM(QTYINVOICEDREF) AS QTYREF,     
@@ -269,7 +270,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
     <![CDATA[
-    SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT, AMOUNT, QTY
+    SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT, SEARCHKEY, UNITPRICE, AMOUNT, QTY
       FROM 
       (SELECT (SELECT O.NAME FROM AD_ORG O WHERE O.AD_ORG_ID = C_INVOICE.AD_ORG_ID) AS ORG,             
        C_BP_GROUP.NAME AS PARTNERGROUP,             
@@ -278,6 +279,8 @@
        TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())) AS INVOICEDATE,  
        M_PRODUCT_CATEGORY.NAME AS PRODCATEGORY,             
        M_PRODUCT.NAME AS PRODUCT,
+       M_PRODUCT.VALUE AS SEARCHKEY, 
+       C_CURRENCY_CONVERT(CASE WHEN C_INVOICELINE.QTYINVOICED = 0 THEN 0 ELSE C_INVOICELINE.LINENETAMT/C_INVOICELINE.QTYINVOICED END, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) AS UNITPRICE,
        CASE WHEN C_DOCTYPE.DOCBASETYPE = 'APC' THEN C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT*-1, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) ELSE C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) END AS AMOUNT,
        CASE WHEN C_DOCTYPE.DOCBASETYPE = 'APC' THEN C_INVOICELINE.QTYINVOICED*-1 ELSE C_INVOICELINE.QTYINVOICED END AS QTY
       FROM C_INVOICELINE left join M_PRODUCT on C_INVOICELINE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
@@ -298,6 +301,7 @@
      ]]></Sql>
     <Parameter name="cCurrencyConv"/>
     <Parameter name="cCurrencyConv"/>
+    <Parameter name="cCurrencyConv"/>
     <Parameter name="adOrgId" optional="true" type="replace" after="AND 0=0 AND C_INVOICE.AD_ORG_ID IN (" text="'1'"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="AND C_INVOICE.AD_CLIENT_ID IN (" text="'6'"/>
     <Parameter name="dateFrom" optional="true" after="AND 1=1"><![CDATA[AND C_INVOICE.DATEINVOICED >= to_date(?)]]></Parameter>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesXLS.jrxml	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportInvoiceVendorDimensionalAnalysesXLS.jrxml	Wed Oct 14 09:43:37 2015 +0200
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="eportInvoiceVendorDimensionalAnalysesXLS" pageWidth="1500" pageHeight="842" orientation="Landscape" columnWidth="1500" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="40dc54a6-0046-4a72-8725-73936874bae9">
+<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="eportInvoiceVendorDimensionalAnalysesXLS" pageWidth="1720" pageHeight="842" orientation="Landscape" columnWidth="1720" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="40dc54a6-0046-4a72-8725-73936874bae9">
 	<property name="ireport.scriptlethandling" value="0"/>
 	<property name="ireport.encoding" value="UTF-8"/>
 	<property name="ireport.zoom" value="1.5"/>
-	<property name="ireport.x" value="1635"/>
+	<property name="ireport.x" value="0"/>
 	<property name="ireport.y" value="0"/>
 	<import value="net.sf.jasperreports.engine.*"/>
 	<import value="java.util.*"/>
@@ -66,7 +66,7 @@
 		<defaultValueExpression><![CDATA["dd/MM/yyyy"]]></defaultValueExpression>
 	</parameter>
 	<queryString>
-		<![CDATA[SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT, AMOUNT, QTY
+		<![CDATA[SELECT ORG, PARTNERGROUP, PARTNER, DOCUMENTNO, INVOICEDATE, PRODCATEGORY, PRODUCT, SEARCHKEY, UNITPRICE, AMOUNT, QTY
       FROM
       (SELECT (SELECT O.NAME FROM AD_ORG O WHERE O.AD_ORG_ID = C_INVOICE.AD_ORG_ID) AS ORG,
        C_BP_GROUP.NAME AS PARTNERGROUP,
@@ -75,6 +75,8 @@
        TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())) AS INVOICEDATE,
        M_PRODUCT_CATEGORY.NAME AS PRODCATEGORY,
        M_PRODUCT.NAME AS PRODUCT,
+       M_PRODUCT.VALUE AS SEARCHKEY,
+       CASE WHEN C_INVOICELINE.QTYINVOICED = 0 THEN 0 ELSE C_INVOICELINE.LINENETAMT/C_INVOICELINE.QTYINVOICED END AS UNITPRICE,
        CASE WHEN C_DOCTYPE.DOCBASETYPE = 'APC' THEN C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT*-1, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) ELSE C_CURRENCY_CONVERT(C_INVOICELINE.LINENETAMT, C_INVOICE.C_CURRENCY_ID, ?, TO_DATE(COALESCE(C_INVOICE.DATEINVOICED, NOW())), NULL, C_INVOICE.AD_CLIENT_ID, C_INVOICE.AD_ORG_ID) END AS AMOUNT,
        CASE WHEN C_DOCTYPE.DOCBASETYPE = 'APC' THEN C_INVOICELINE.QTYINVOICED*-1 ELSE C_INVOICELINE.QTYINVOICED END AS QTY
       FROM C_INVOICELINE left join M_PRODUCT on C_INVOICELINE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
@@ -100,6 +102,8 @@
 	<field name="INVOICEDATE" class="java.util.Date"/>
 	<field name="PRODCATEGORY" class="java.lang.String"/>
 	<field name="PRODUCT" class="java.lang.String"/>
+	<field name="SEARCHKEY" class="java.lang.String"/>
+	<field name="UNITPRICE" class="java.math.BigDecimal"/>
 	<field name="AMOUNT" class="java.math.BigDecimal"/>
 	<field name="QTY" class="java.math.BigDecimal"/>
 	<background>
@@ -202,7 +206,46 @@
 				<text><![CDATA[Product]]></text>
 			</staticText>
 			<staticText>
-				<reportElement key="element-8" style="Detail_Header" x="1300" y="0" width="100" height="15" uuid="bd70f22d-7f1c-4d11-a3d6-c402dc8a10ec"/>
+				<reportElement key="element-7-1" style="Detail_Header" x="1300" y="0" width="120" height="15"/>
+				<box leftPadding="5" rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+				<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#333333"/>
+				</box>
+				<textElement>
+					<font size="8"/>
+				</textElement>
+				<text><![CDATA[Product Search Key]]></text>
+			</staticText>
+			<staticText>
+				<reportElement key="element-9" style="Detail_Header" x="1420" y="0" width="100" height="15" uuid="b0747cc2-9380-4f8e-852e-08998bc98bb8"/>
+				<box leftPadding="5" rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#333333"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<text><![CDATA[Quantity]]></text>
+			</staticText>
+			<staticText>
+				<reportElement key="element-7-2" style="Detail_Header" x="1520" y="0" width="100" height="15"/>
+				<box leftPadding="5" rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#333333"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<text><![CDATA[Unit Price]]></text>
+			</staticText>
+			<staticText>
+				<reportElement key="element-8" style="Detail_Header" x="1620" y="0" width="100" height="15" uuid="bd70f22d-7f1c-4d11-a3d6-c402dc8a10ec"/>
 				<box leftPadding="5" rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -214,19 +257,6 @@
 				</textElement>
 				<text><![CDATA[Amount]]></text>
 			</staticText>
-			<staticText>
-				<reportElement key="element-9" style="Detail_Header" x="1400" y="0" width="100" height="15" uuid="b0747cc2-9380-4f8e-852e-08998bc98bb8"/>
-				<box leftPadding="5" rightPadding="2">
-					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<bottomPen lineWidth="0.0" lineColor="#000000"/>
-					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#333333"/>
-				</box>
-				<textElement textAlignment="Right">
-					<font size="8"/>
-				</textElement>
-				<text><![CDATA[Quantity]]></text>
-			</staticText>
 		</band>
 	</pageHeader>
 	<columnHeader>
@@ -315,8 +345,42 @@
 				</textElement>
 				<textFieldExpression><![CDATA[$F{PRODUCT}]]></textFieldExpression>
 			</textField>
+			<textField isStretchWithOverflow="true" isBlankWhenNull="true">
+				<reportElement key="textField-7" stretchType="RelativeToBandHeight" x="1300" y="0" width="120" height="13"/>
+				<box rightPadding="2"/>
+				<textElement>
+					<font size="8"/>
+				</textElement>
+				<textFieldExpression class="java.lang.String"><![CDATA[$F{SEARCHKEY}]]></textFieldExpression>
+			</textField>
+			<textField pattern="" isBlankWhenNull="true">
+				<reportElement key="textField-9" stretchType="RelativeToBandHeight" x="1420" y="0" width="100" height="13" uuid="5ada6fb4-da6b-473e-a02c-d9c6179d984c"/>
+				<box rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<textFieldExpression><![CDATA[$F{QTY}]]></textFieldExpression>
+			</textField>
 			<textField pattern="" isBlankWhenNull="false">
-				<reportElement key="textField-8" stretchType="RelativeToBandHeight" x="1300" y="0" width="100" height="13" uuid="b230f45b-0364-40cb-ae4d-72fc46e0a1c4"/>
+				<reportElement key="textField-8" stretchType="RelativeToBandHeight" x="1520" y="0" width="100" height="13" uuid="b230f45b-0364-40cb-ae4d-72fc46e0a1c4"/>
+				<box rightPadding="2">
+					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+					<bottomPen lineWidth="0.0" lineColor="#000000"/>
+					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
+				</box>
+				<textElement textAlignment="Right">
+					<font size="8"/>
+				</textElement>
+				<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{UNITPRICE}]]></textFieldExpression>
+			</textField>
+			<textField pattern="" isBlankWhenNull="false">
+				<reportElement key="textField-8" stretchType="RelativeToBandHeight" x="1620" y="0" width="100" height="13"/>
 				<box rightPadding="2">
 					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
 					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
@@ -328,19 +392,6 @@
 				</textElement>
 				<textFieldExpression><![CDATA[$F{AMOUNT}]]></textFieldExpression>
 			</textField>
-			<textField pattern="" isBlankWhenNull="true">
-				<reportElement key="textField-9" stretchType="RelativeToBandHeight" x="1400" y="0" width="100" height="13" uuid="5ada6fb4-da6b-473e-a02c-d9c6179d984c"/>
-				<box rightPadding="2">
-					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-					<bottomPen lineWidth="0.0" lineColor="#000000"/>
-					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
-				</box>
-				<textElement textAlignment="Right">
-					<font size="8"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$F{QTY}]]></textFieldExpression>
-			</textField>
 		</band>
 	</detail>
 	<columnFooter>
--- a/src/org/openbravo/event/ProcessRequestEventHandler.java	Wed Oct 07 09:31:15 2015 +0200
+++ b/src/org/openbravo/event/ProcessRequestEventHandler.java	Wed Oct 14 09:43:37 2015 +0200
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2015 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -28,10 +28,14 @@
 import org.openbravo.client.kernel.event.EntityNewEvent;
 import org.openbravo.client.kernel.event.EntityPersistenceEvent;
 import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
+import org.openbravo.client.kernel.event.EntityUpdateEvent;
+import org.openbravo.costing.CostingUtils;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.model.ad.ui.Process;
 import org.openbravo.model.ad.ui.ProcessGroup;
+import org.openbravo.model.ad.ui.ProcessGroupList;
 import org.openbravo.model.ad.ui.ProcessRequest;
+import org.openbravo.model.common.enterprise.Organization;
 
 /**
  * Event Handler to check Process Group fields consistency
@@ -47,12 +51,20 @@
     return entities;
   }
 
-  public void onSave(@Observes
-  EntityNewEvent event) {
+  public void onSave(@Observes EntityNewEvent event) {
     if (!isValidEvent(event)) {
       return;
     }
     checkMandatoryFields(event);
+    checkValidOrganizationCostingServer(event);
+  }
+
+  public void onUpdate(@Observes EntityUpdateEvent event) {
+    if (!isValidEvent(event)) {
+      return;
+    }
+
+    checkValidOrganizationCostingServer(event);
   }
 
   private void checkMandatoryFields(EntityPersistenceEvent event) {
@@ -87,4 +99,45 @@
     }
 
   }
+
+  /**
+   * Returns and exception when the Costing Background Process has been scheduled for a child of a
+   * legal entity organization.
+   * 
+   * This method checks a process request for a single process or for a group of processes
+   * (iterating over the process group list)
+   */
+  private void checkValidOrganizationCostingServer(EntityPersistenceEvent event) {
+    if (event != null && (event instanceof EntityNewEvent || event instanceof EntityUpdateEvent)) {
+      final Entity processRequestEntity = ModelProvider.getInstance().getEntity(
+          ProcessRequest.ENTITY_NAME);
+
+      final Property isGroupNameProperty = processRequestEntity
+          .getProperty(ProcessRequest.PROPERTY_ISGROUP);
+      final Property orgProperty = processRequestEntity
+          .getProperty(ProcessRequest.PROPERTY_ORGANIZATION);
+
+      final Boolean isGroup = (Boolean) event.getCurrentState(isGroupNameProperty);
+      final Organization scheduledOrg = (Organization) event.getCurrentState(orgProperty);
+
+      if (isGroup != null && isGroup.booleanValue()) {
+        // Check for all the Processes defined in the group
+        final Property processGroupProperty = processRequestEntity
+            .getProperty(ProcessRequest.PROPERTY_PROCESSGROUP);
+        final ProcessGroup processGroup = (ProcessGroup) event
+            .getCurrentState(processGroupProperty);
+
+        for (final ProcessGroupList pgl : processGroup.getProcessGroupListList()) {
+          CostingUtils.checkValidOrganization(pgl.getProcess().getId(), scheduledOrg);
+        }
+      } else {
+        final Property processProperty = processRequestEntity
+            .getProperty(ProcessRequest.PROPERTY_PROCESS);
+        final Process scheduledProcess = (Process) event.getCurrentState(processProperty);
+
+        CostingUtils.checkValidOrganization(scheduledProcess.getId(), scheduledOrg);
+      }
+    }
+  }
+
 }