Fixes issue 38339: Customer Statement. Multicurrency
authorAdrián Romero <adrianromero@openbravo.com>
Wed, 27 Mar 2019 12:38:33 +0100
changeset 35675 b5f2a6f4813a
parent 35674 da4cd5a315dd
child 35676 a85380315784
Fixes issue 38339: Customer Statement. Multicurrency
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_PROCESS_PARA.xml
src-db/database/sourcedata/AD_TEXTINTERFACES.xml
src/org/openbravo/erpCommon/ReportsUtility.java
src/org/openbravo/erpCommon/ad_reports/CustomerStatement.jrxml
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Mar 27 12:33:29 2019 +0100
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Mar 27 12:38:33 2019 +0100
@@ -23352,6 +23352,20 @@
 <!--40779C622B254653A740320DF4942401-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--40779C622B254653A740320DF4942401--></AD_ELEMENT>
 
+<!--40843E6A2FF544529C71F6380B0600E2--><AD_ELEMENT>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <AD_ELEMENT_ID><![CDATA[40843E6A2FF544529C71F6380B0600E2]]></AD_ELEMENT_ID>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <COLUMNNAME><![CDATA[Multicurrency]]></COLUMNNAME>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <NAME><![CDATA[Multicurrency]]></NAME>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <PRINTNAME><![CDATA[Multicurrency]]></PRINTNAME>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <DESCRIPTION><![CDATA[If checked the report is created and grouped using the source currency of documents]]></DESCRIPTION>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <HELP><![CDATA[If checked the report is created and grouped using the source currency of documents.]]></HELP>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--40843E6A2FF544529C71F6380B0600E2-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--40843E6A2FF544529C71F6380B0600E2--></AD_ELEMENT>
+
 <!--40C07969C9DD485BBEAEDA4B70886C2E--><AD_ELEMENT>
 <!--40C07969C9DD485BBEAEDA4B70886C2E-->  <AD_ELEMENT_ID><![CDATA[40C07969C9DD485BBEAEDA4B70886C2E]]></AD_ELEMENT_ID>
 <!--40C07969C9DD485BBEAEDA4B70886C2E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Wed Mar 27 12:33:29 2019 +0100
+++ b/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Wed Mar 27 12:38:33 2019 +0100
@@ -4712,6 +4712,26 @@
 <!--E15C3460969D4583BD954308E715C5D4-->  <AD_ELEMENT_ID><![CDATA[800653]]></AD_ELEMENT_ID>
 <!--E15C3460969D4583BD954308E715C5D4--></AD_PROCESS_PARA>
 
+<!--E6335CACA0A34C90B477B49328E0E494--><AD_PROCESS_PARA>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <AD_PROCESS_PARA_ID><![CDATA[E6335CACA0A34C90B477B49328E0E494]]></AD_PROCESS_PARA_ID>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <NAME><![CDATA[Multicurrency]]></NAME>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <DESCRIPTION><![CDATA[If checked the report is created and grouped using the source currency of documents]]></DESCRIPTION>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <HELP><![CDATA[If checked the report is created and grouped using the source currency of documents.]]></HELP>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <AD_PROCESS_ID><![CDATA[D234AE084F7040DCB66E281A4237FF99]]></AD_PROCESS_ID>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <SEQNO><![CDATA[45]]></SEQNO>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <COLUMNNAME><![CDATA[Multicurrency]]></COLUMNNAME>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--E6335CACA0A34C90B477B49328E0E494-->  <AD_ELEMENT_ID><![CDATA[40843E6A2FF544529C71F6380B0600E2]]></AD_ELEMENT_ID>
+<!--E6335CACA0A34C90B477B49328E0E494--></AD_PROCESS_PARA>
+
 <!--EAE447CD0ACE4C3B9D037847B5B5571C--><AD_PROCESS_PARA>
 <!--EAE447CD0ACE4C3B9D037847B5B5571C-->  <AD_PROCESS_PARA_ID><![CDATA[EAE447CD0ACE4C3B9D037847B5B5571C]]></AD_PROCESS_PARA_ID>
 <!--EAE447CD0ACE4C3B9D037847B5B5571C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Wed Mar 27 12:33:29 2019 +0100
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Wed Mar 27 12:38:33 2019 +0100
@@ -11863,6 +11863,17 @@
 <!--27446C44A1F411DD90E5475409233A52-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--27446C44A1F411DD90E5475409233A52--></AD_TEXTINTERFACES>
 
+<!--2777F19C4A0D42148B5A12B5B7468294--><AD_TEXTINTERFACES>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <AD_TEXTINTERFACES_ID><![CDATA[2777F19C4A0D42148B5A12B5B7468294]]></AD_TEXTINTERFACES_ID>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <TEXT><![CDATA[Currency]]></TEXT>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/CustomerStatement.jrxml]]></FILENAME>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <ISUSED><![CDATA[N]]></ISUSED>
+<!--2777F19C4A0D42148B5A12B5B7468294-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--2777F19C4A0D42148B5A12B5B7468294--></AD_TEXTINTERFACES>
+
 <!--2783F652A1F411DDA89BDF610A666E97--><AD_TEXTINTERFACES>
 <!--2783F652A1F411DDA89BDF610A666E97-->  <AD_TEXTINTERFACES_ID><![CDATA[2783F652A1F411DDA89BDF610A666E97]]></AD_TEXTINTERFACES_ID>
 <!--2783F652A1F411DDA89BDF610A666E97-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ReportsUtility.java	Wed Mar 27 12:33:29 2019 +0100
+++ b/src/org/openbravo/erpCommon/ReportsUtility.java	Wed Mar 27 12:38:33 2019 +0100
@@ -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) 2013 Openbravo SLU
+ * All portions are Copyright (C) 2013-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -34,6 +34,7 @@
 import org.openbravo.model.common.businesspartner.BusinessPartner;
 import org.openbravo.model.common.businesspartner.CustomerAccounts;
 import org.openbravo.model.common.businesspartner.VendorAccounts;
+import org.openbravo.model.common.currency.Currency;
 import org.openbravo.model.common.enterprise.Organization;
 import org.openbravo.model.financialmgmt.accounting.AccountingFact;
 import org.openbravo.model.financialmgmt.accounting.coa.AcctSchema;
@@ -43,11 +44,16 @@
 
   public static BigDecimal getBeginningBalance(String orgId, String acctSchemaId, String bpartnerId,
       String dateFrom) {
-    return getBeginningBalance(orgId, acctSchemaId, bpartnerId, dateFrom, true);
+    return getBeginningBalance(orgId, acctSchemaId, bpartnerId, dateFrom, true, null);
   }
 
   public static BigDecimal getBeginningBalance(String orgId, String acctSchemaId, String bpartnerId,
       String dateFrom, boolean isCustomer) {
+    return getBeginningBalance(orgId, acctSchemaId, bpartnerId, dateFrom, isCustomer, null);
+  }
+
+  public static BigDecimal getBeginningBalance(String orgId, String acctSchemaId, String bpartnerId,
+      String dateFrom, boolean isCustomer, String currency) {
     if (dateFrom == null || "".equals(dateFrom)) {
       return BigDecimal.ZERO;
     }
@@ -63,6 +69,10 @@
     } catch (ParseException pe) {
       // do nothing
     }
+    if (currency != null) {
+      obc.add(Restrictions.eq(AccountingFact.PROPERTY_CURRENCY,
+          OBDal.getInstance().getProxy(Currency.class, currency)));
+    }
     if (isCustomer) {
       List<ElementValue> accL = getValidAccountsList(acctSchemaId, bpartnerId);
       if (!accL.isEmpty()) {
@@ -77,8 +87,10 @@
     obc.setFilterOnReadableOrganization(false);
 
     ProjectionList projections = Projections.projectionList();
-    projections.add(Projections.sum(AccountingFact.PROPERTY_DEBIT));
-    projections.add(Projections.sum(AccountingFact.PROPERTY_CREDIT));
+    projections.add(Projections.sum(currency == null ? AccountingFact.PROPERTY_DEBIT
+        : AccountingFact.PROPERTY_FOREIGNCURRENCYDEBIT));
+    projections.add(Projections.sum(currency == null ? AccountingFact.PROPERTY_CREDIT
+        : AccountingFact.PROPERTY_FOREIGNCURRENCYCREDIT));
     obc.setProjection(projections);
 
     @SuppressWarnings("rawtypes")
--- a/src/org/openbravo/erpCommon/ad_reports/CustomerStatement.jrxml	Wed Mar 27 12:33:29 2019 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/CustomerStatement.jrxml	Wed Mar 27 12:38:33 2019 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Created with Jaspersoft Studio version 6.0.0.final using JasperReports Library version 6.0.0  -->
-<!-- 2015-11-26T18:11:29 -->
+<!-- Created with Jaspersoft Studio version 6.0.0.final using JasperReports Library version 6.0.0  -->
+<!-- 2018-04-11T09:20:09 -->
 <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="Customer Statement" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="497a0ae3-5aac-448b-a8a4-4b6619407498">
 	<property name="ireport.scriptlethandling" value="0"/>
 	<property name="ireport.encoding" value="UTF-8"/>
@@ -72,6 +72,7 @@
 	</parameter>
 	<parameter name="reportType" class="java.lang.String"/>
 	<parameter name="sumInitialBalance" class="java.lang.String"/>
+        <parameter name="Multicurrency" class="java.lang.String"/>
 	<queryString>
 		<![CDATA[SELECT trunc(f.dateacct) as dateacct,
         CASE WHEN f.c_doctype_id IS NOT NULL THEN (SELECT MIN(name)
@@ -83,17 +84,21 @@
               AND value = f.docbasetype)
         END as documenttype,
     f.description,
-    f.amtacctdr as debit,
-    f.amtacctcr as credit,
-    (f.amtacctdr-f.amtacctcr) as net,
+    (CASE WHEN $P{Multicurrency} = 'Y' THEN f.amtsourcedr ELSE f.amtacctdr END) as debit,
+    (CASE WHEN $P{Multicurrency} = 'Y' THEN f.amtsourcecr ELSE f.amtacctcr END) as credit,
+    (CASE WHEN $P{Multicurrency} = 'Y' THEN (f.amtsourcedr - f.amtsourcecr) ELSE (f.amtacctdr - f.amtacctcr) END) as net,
+    (CASE WHEN $P{Multicurrency} = 'Y' THEN f.c_currency_id ELSE NULL END) as currency_id,
+    curr.iso_code as currency_code,
+    curr.description as currency_name,
     bp.name as bpname, o.ad_org_id as organizationid,
     loc.address1 || ' ' || COALESCE(TO_CHAR(loc.address2), TO_CHAR('')) as org_address,
     loc.city || ', ' || ad_column_identifier('C_Region', loc.c_region_id, 'en_US') || ' ' || loc.postal
     || ' ' || ad_column_identifier('C_Country', loc.c_country_id, 'en_US') AS org_postal,
     (SELECT MAX(email) FROM ad_user WHERE ad_user_id=oinfo.ad_user_id) as email,
     (SELECT MAX(phone) FROM ad_user WHERE ad_user_id=oinfo.ad_user_id) as phone,
-    issotrx.issotrx
+    issotrx.issotrx as issotrx
 FROM fact_acct f
+    JOIN c_currency curr ON (f.c_currency_id = curr.c_currency_id)
     LEFT JOIN c_acctschema acct ON (f.c_acctschema_id=acct.c_acctschema_id)
     LEFT JOIN c_bpartner bp ON (f.c_bpartner_id=bp.c_bpartner_id)
     JOIN (SELECT ad_org_id
@@ -143,7 +148,7 @@
     AND trunc(f.dateacct) <= (CASE WHEN ($P{DateTo} IS NULL OR $P{DateTo}='') THEN TO_DATE('09-09-9999')
         ELSE TO_DATE($P{DateTo}) END)
     AND f.ad_table_id not IN ('145')
-ORDER BY f.dateacct, f.created]]>
+ORDER BY currency_id, issotrx, f.dateacct, f.created]]>
 	</queryString>
 	<field name="org_address" class="java.lang.String"/>
 	<field name="org_postal" class="java.lang.String"/>
@@ -157,8 +162,17 @@
 	<field name="debit" class="java.math.BigDecimal"/>
 	<field name="credit" class="java.math.BigDecimal"/>
 	<field name="net" class="java.math.BigDecimal"/>
+	<field name="currency_id" class="java.lang.String">
+		<fieldDescription><![CDATA[]]></fieldDescription>
+	</field>
+	<field name="currency_code" class="java.lang.String">
+		<fieldDescription><![CDATA[]]></fieldDescription>
+	</field>
+	<field name="currency_name" class="java.lang.String">
+		<fieldDescription><![CDATA[]]></fieldDescription>
+	</field>
 	<field name="issotrx" class="java.lang.String"/>
-	<variable name="SUM" class="java.math.BigDecimal" resetType="Group" resetGroup="Customer" calculation="Sum">
+	<variable name="SUM" class="java.math.BigDecimal" resetType="Group" resetGroup="Sales / Purchase" calculation="Sum">
 		<variableExpression><![CDATA[$F{net}]]></variableExpression>
 	</variable>
 	<variable name="DateFrom" class="java.util.Date" calculation="Lowest">
@@ -167,25 +181,25 @@
 	<variable name="DateTo" class="java.util.Date" calculation="Highest">
 		<variableExpression><![CDATA[$F{dateacct}]]></variableExpression>
 	</variable>
-	<variable name="customerInitialBalance" class="java.math.BigDecimal">
-		<variableExpression><![CDATA[ReportsUtility.getBeginningBalance($P{AD_Org_ID}, $P{C_AcctSchema_ID}, $P{C_BPartner_ID}, $P{DateFrom}, true)]]></variableExpression>
+	<variable name="customerInitialBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Currency">
+		<variableExpression><![CDATA[ReportsUtility.getBeginningBalance($P{AD_Org_ID}, $P{C_AcctSchema_ID}, $P{C_BPartner_ID}, $P{DateFrom}, true, $F{currency_id})]]></variableExpression>
 	</variable>
-	<variable name="customerBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Customer">
+	<variable name="customerBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Sales / Purchase">
 		<variableExpression><![CDATA[$V{customerInitialBalance}.add($V{SUM})]]></variableExpression>
 	</variable>
-	<variable name="vendorInitialBalance" class="java.math.BigDecimal">
-		<variableExpression><![CDATA[ReportsUtility.getBeginningBalance($P{AD_Org_ID}, $P{C_AcctSchema_ID}, $P{C_BPartner_ID}, $P{DateFrom}, false)]]></variableExpression>
+	<variable name="vendorInitialBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Currency">
+		<variableExpression><![CDATA[ReportsUtility.getBeginningBalance($P{AD_Org_ID}, $P{C_AcctSchema_ID}, $P{C_BPartner_ID}, $P{DateFrom}, false, $F{currency_id})]]></variableExpression>
 	</variable>
-	<variable name="vendorBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Customer">
+	<variable name="vendorBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Sales / Purchase">
 		<variableExpression><![CDATA[$V{vendorInitialBalance}.add($V{SUM})]]></variableExpression>
 	</variable>
-	<variable name="TOTALSUM" class="java.math.BigDecimal" calculation="Sum">
+	<variable name="TOTALSUM" class="java.math.BigDecimal" resetType="Group" resetGroup="Currency" calculation="Sum">
 		<variableExpression><![CDATA[$F{net}]]></variableExpression>
 	</variable>
-	<variable name="totalBalance" class="java.math.BigDecimal">
+	<variable name="totalBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Currency">
 		<variableExpression><![CDATA[$V{TOTALSUM}.add($V{customerInitialBalance}).add($V{vendorInitialBalance})]]></variableExpression>
 	</variable>
-	<variable name="totalInitialBalance" class="java.math.BigDecimal">
+	<variable name="totalInitialBalance" class="java.math.BigDecimal" resetType="Group" resetGroup="Currency">
 		<variableExpression><![CDATA[$V{vendorInitialBalance}.add($V{customerInitialBalance})]]></variableExpression>
 	</variable>
 	<group name="PrintLarge" isReprintHeaderOnEachPage="true">
@@ -194,7 +208,91 @@
 	<group name="PrintMedium" isReprintHeaderOnEachPage="true">
 		<groupExpression><![CDATA[]]></groupExpression>
 	</group>
-	<group name="Customer" isReprintHeaderOnEachPage="true">
+	<group name="Currency" isStartNewPage="true" isReprintHeaderOnEachPage="true">
+		<groupExpression><![CDATA[$F{currency_id}]]></groupExpression>
+		<groupHeader>
+			<band height="18">
+				<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
+				<printWhenExpression><![CDATA["Y".equals($P{Multicurrency})]]></printWhenExpression>
+				<textField>
+					<reportElement x="80" y="0" width="30" height="12" uuid="688616ea-456f-4d6f-bc04-0c3e5066ae6b">
+						<property name="local_mesure_unitheight" value="pixel"/>
+						<property name="com.jaspersoft.studio.unit.height" value="px"/>
+					</reportElement>
+					<textElement>
+						<font fontName="DejaVu Sans"/>
+					</textElement>
+					<textFieldExpression><![CDATA[$F{currency_code}]]></textFieldExpression>
+				</textField>
+				<textField>
+					<reportElement x="110" y="0" width="243" height="12" uuid="f8b29d19-412a-4998-8f35-03550e7d78eb">
+						<property name="local_mesure_unitheight" value="pixel"/>
+						<property name="com.jaspersoft.studio.unit.height" value="px"/>
+					</reportElement>
+					<textElement>
+						<font fontName="DejaVu Sans"/>
+					</textElement>
+					<textFieldExpression><![CDATA[$F{currency_name}]]></textFieldExpression>
+				</textField>
+				<staticText>
+					<reportElement x="0" y="0" width="80" height="12" uuid="003bd68e-0af5-4a3d-a985-7aefb853337f"/>
+					<textElement verticalAlignment="Bottom">
+						<font fontName="DejaVu Sans" size="10" isBold="false"/>
+					</textElement>
+					<text><![CDATA[Currency]]></text>
+				</staticText>
+			</band>
+		</groupHeader>
+		<groupFooter>
+			<band height="67">
+				<printWhenExpression><![CDATA[$P{reportType}.equals("both")]]></printWhenExpression>
+				<line>
+					<reportElement x="236" y="47" width="320" height="3" uuid="382bf123-c27c-426b-a320-1a2df3a239e9"/>
+				</line>
+				<line>
+					<reportElement x="236" y="45" width="320" height="3" uuid="5d70d63d-44fd-446f-ba3f-04bfa9101df7"/>
+				</line>
+				<staticText>
+					<reportElement positionType="Float" mode="Opaque" x="236" y="32" width="210" height="15" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#FFFFFF" uuid="4b7939f4-7137-4121-a9e9-687b1e20cc84"/>
+					<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
+						<font fontName="DejaVu Sans" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
+						<paragraph lineSpacing="Single"/>
+					</textElement>
+					<text><![CDATA[Business Partner Balance :]]></text>
+				</staticText>
+				<line>
+					<reportElement x="236" y="17" width="320" height="1" uuid="cd37578f-91ec-4417-ad1c-e1f2889f6d6a"/>
+				</line>
+				<textField evaluationTime="Report" pattern="" isBlankWhenNull="true">
+					<reportElement positionType="Float" mode="Transparent" x="446" y="32" width="110" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="3d009a3e-d394-4eba-a4f7-7b29d5b99f74"/>
+					<box rightPadding="5"/>
+					<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
+						<font fontName="DejaVu Sans" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
+						<paragraph lineSpacing="Single"/>
+					</textElement>
+					<textFieldExpression><![CDATA[$V{totalBalance}.compareTo(BigDecimal.ZERO) < 0 ? $V{totalBalance}.abs() : $V{totalBalance}]]></textFieldExpression>
+					<patternExpression><![CDATA[$V{totalBalance}.compareTo(BigDecimal.ZERO) < 0 ? ("("+$P{NUMBERFORMAT}.toPattern()+")") : $P{NUMBERFORMAT}.toPattern()]]></patternExpression>
+				</textField>
+				<staticText>
+					<reportElement x="236" y="3" width="210" height="14" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#FFFFFF" uuid="62499066-a0e4-46b3-bd28-3e611823c5dd"/>
+					<textElement textAlignment="Right" verticalAlignment="Top">
+						<font fontName="DejaVu Sans" size="10" isBold="true"/>
+					</textElement>
+					<text><![CDATA[Business Partner Initial Balance :]]></text>
+				</staticText>
+				<textField isStretchWithOverflow="true" evaluationTime="Report" pattern="" isBlankWhenNull="true">
+					<reportElement style="Detail_Line" stretchType="RelativeToTallestObject" mode="Transparent" x="446" y="3" width="110" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="db8ea373-d4a6-4a80-9543-edb9914382c4"/>
+					<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
+						<font fontName="DejaVu Sans" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
+						<paragraph lineSpacing="Single"/>
+					</textElement>
+					<textFieldExpression><![CDATA[$V{totalInitialBalance}.compareTo(BigDecimal.ZERO) < 0 ? $V{totalInitialBalance}.abs() : $V{totalInitialBalance}]]></textFieldExpression>
+					<patternExpression><![CDATA[$V{totalInitialBalance}.compareTo(BigDecimal.ZERO) < 0 ? ("("+$P{NUMBERFORMAT}.toPattern()+")") : $P{NUMBERFORMAT}.toPattern()]]></patternExpression>
+				</textField>
+			</band>
+		</groupFooter>
+	</group>
+	<group name="Sales / Purchase" isReprintHeaderOnEachPage="true">
 		<groupExpression><![CDATA[$F{issotrx}]]></groupExpression>
 		<groupHeader>
 			<band height="78">
@@ -274,10 +372,10 @@
 					<reportElement x="0" y="49" width="555" height="1" uuid="750cccdd-cdc1-4e35-8fef-cd0bc3440eff"/>
 				</line>
 				<staticText>
-					<reportElement x="1" y="7" width="330" height="20" forecolor="#595959" uuid="fcaab7ce-176e-4b44-81c4-a9df9f2bb719">
+					<reportElement stretchType="RelativeToBandHeight" x="1" y="7" width="330" height="20" forecolor="#595959" uuid="fcaab7ce-176e-4b44-81c4-a9df9f2bb719">
 						<printWhenExpression><![CDATA[$P{reportType}.equals("both") && $F{issotrx}.equals("N")]]></printWhenExpression>
 					</reportElement>
-					<textElement>
+					<textElement markup="html">
 						<font fontName="DejaVu Sans" size="16"/>
 					</textElement>
 					<text><![CDATA[Vendor Statement]]></text>
@@ -297,7 +395,7 @@
 		</groupHeader>
 		<groupFooter>
 			<band height="44">
-				<textField evaluationTime="Group" evaluationGroup="Customer" pattern="" isBlankWhenNull="true">
+				<textField evaluationTime="Group" evaluationGroup="Sales / Purchase" pattern="" isBlankWhenNull="true">
 					<reportElement positionType="Float" mode="Transparent" x="445" y="12" width="110" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="a75fd489-5f32-4dba-adc8-d961d69350fe">
 						<printWhenExpression><![CDATA[($P{reportType}.equals("cus")) || ($P{reportType}.equals("both") && $F{issotrx}.equals("Y"))]]></printWhenExpression>
 					</reportElement>
@@ -323,7 +421,7 @@
 				<line>
 					<reportElement x="330" y="29" width="225" height="1" uuid="d705d5a1-56f8-4f10-80fb-171f41cf12a9"/>
 				</line>
-				<textField evaluationTime="Group" evaluationGroup="Customer" pattern="" isBlankWhenNull="true">
+				<textField evaluationTime="Group" evaluationGroup="Sales / Purchase" pattern="" isBlankWhenNull="true">
 					<reportElement positionType="Float" mode="Transparent" x="445" y="12" width="110" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="5ebb7055-46fa-4b7a-bf93-a40c5a017d07">
 						<printWhenExpression><![CDATA[($P{reportType}.equals("ven")) || ($P{reportType}.equals("both") && $F{issotrx}.equals("N"))]]></printWhenExpression>
 					</reportElement>
@@ -345,7 +443,7 @@
 		<band splitType="Stretch"/>
 	</title>
 	<pageHeader>
-		<band height="146" splitType="Stretch">
+		<band height="141" splitType="Stretch">
 			<rectangle>
 				<reportElement key="" x="0" y="0" width="559" height="77" isPrintInFirstWholeBand="true" forecolor="#FFFFFF" backcolor="#FFFFFF" uuid="a61f942d-14ea-46fc-865a-0fd446b65e6f"/>
 			</rectangle>
@@ -427,21 +525,21 @@
 				<text><![CDATA[From]]></text>
 			</staticText>
 			<textField evaluationTime="Report">
-				<reportElement x="33" y="124" width="45" height="12" uuid="0d10c075-8588-4aba-b65a-7216a84b11ad"/>
+				<reportElement x="80" y="124" width="45" height="12" uuid="0d10c075-8588-4aba-b65a-7216a84b11ad"/>
 				<textElement textAlignment="Right" verticalAlignment="Bottom">
 					<font fontName="DejaVu Sans" size="10" isBold="false"/>
 				</textElement>
 				<textFieldExpression><![CDATA[$P{DateFrom} != null ? DateFormat.getDateInstance(DateFormat.SHORT,$P{LOCALE}).format($P{DATEFORMAT}.parse($P{DateFrom}))  : DateFormat.getDateInstance(DateFormat.SHORT,$P{LOCALE}).format($V{DateFrom})]]></textFieldExpression>
 			</textField>
 			<textField evaluationTime="Report" isBlankWhenNull="true">
-				<reportElement x="96" y="124" width="45" height="12" uuid="92cbe9ad-289f-4912-b262-215fae340e01"/>
+				<reportElement x="143" y="124" width="45" height="12" uuid="92cbe9ad-289f-4912-b262-215fae340e01"/>
 				<textElement verticalAlignment="Bottom">
 					<font fontName="DejaVu Sans" size="10" isBold="false"/>
 				</textElement>
 				<textFieldExpression><![CDATA[$P{DateTo}  != null ? DateFormat.getDateInstance(DateFormat.SHORT,$P{LOCALE}).format($P{DATEFORMAT}.parse($P{DateTo})) : DateFormat.getDateInstance(DateFormat.SHORT,$P{LOCALE}).format($V{DateTo})]]></textFieldExpression>
 			</textField>
 			<staticText>
-				<reportElement x="78" y="124" width="18" height="12" uuid="5cf7ca7b-3437-4ecb-8a88-06fdc9224186"/>
+				<reportElement x="125" y="124" width="18" height="12" uuid="5cf7ca7b-3437-4ecb-8a88-06fdc9224186"/>
 				<textElement textAlignment="Center" verticalAlignment="Bottom">
 					<font fontName="DejaVu Sans" size="10" isBold="false"/>
 				</textElement>
@@ -516,52 +614,4 @@
 			</textField>
 		</band>
 	</detail>
-	<summary>
-		<band height="66" splitType="Stretch">
-			<printWhenExpression><![CDATA[$P{reportType}.equals("both")]]></printWhenExpression>
-			<textField isStretchWithOverflow="true" evaluationTime="Report" pattern="" isBlankWhenNull="true">
-				<reportElement style="Detail_Line" stretchType="RelativeToTallestObject" mode="Transparent" x="445" y="13" width="110" height="14" forecolor="#000000" backcolor="#FFFFFF" uuid="db8ea373-d4a6-4a80-9543-edb9914382c4"/>
-				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
-					<font fontName="DejaVu Sans" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
-					<paragraph lineSpacing="Single"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$V{totalInitialBalance}.compareTo(BigDecimal.ZERO) < 0 ? $V{totalInitialBalance}.abs() : $V{totalInitialBalance}]]></textFieldExpression>
-				<patternExpression><![CDATA[$V{totalInitialBalance}.compareTo(BigDecimal.ZERO) < 0 ? ("("+$P{NUMBERFORMAT}.toPattern()+")") : $P{NUMBERFORMAT}.toPattern()]]></patternExpression>
-			</textField>
-			<staticText>
-				<reportElement x="235" y="13" width="210" height="14" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#FFFFFF" uuid="62499066-a0e4-46b3-bd28-3e611823c5dd"/>
-				<textElement textAlignment="Right" verticalAlignment="Top">
-					<font fontName="DejaVu Sans" size="10" isBold="true"/>
-				</textElement>
-				<text><![CDATA[Business Partner Initial Balance :]]></text>
-			</staticText>
-			<line>
-				<reportElement x="235" y="27" width="320" height="1" uuid="cd37578f-91ec-4417-ad1c-e1f2889f6d6a"/>
-			</line>
-			<staticText>
-				<reportElement positionType="Float" mode="Opaque" x="235" y="42" width="210" height="15" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#FFFFFF" uuid="4b7939f4-7137-4121-a9e9-687b1e20cc84"/>
-				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
-					<font fontName="DejaVu Sans" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
-					<paragraph lineSpacing="Single"/>
-				</textElement>
-				<text><![CDATA[Business Partner Balance :]]></text>
-			</staticText>
-			<line>
-				<reportElement x="235" y="55" width="320" height="3" uuid="5d70d63d-44fd-446f-ba3f-04bfa9101df7"/>
-			</line>
-			<textField evaluationTime="Report" pattern="" isBlankWhenNull="true">
-				<reportElement positionType="Float" mode="Transparent" x="445" y="42" width="110" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="3d009a3e-d394-4eba-a4f7-7b29d5b99f74"/>
-				<box rightPadding="5"/>
-				<textElement textAlignment="Right" verticalAlignment="Middle" rotation="None" markup="none">
-					<font fontName="DejaVu Sans" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
-					<paragraph lineSpacing="Single"/>
-				</textElement>
-				<textFieldExpression><![CDATA[$V{totalBalance}.compareTo(BigDecimal.ZERO) < 0 ? $V{totalBalance}.abs() : $V{totalBalance}]]></textFieldExpression>
-				<patternExpression><![CDATA[$V{totalBalance}.compareTo(BigDecimal.ZERO) < 0 ? ("("+$P{NUMBERFORMAT}.toPattern()+")") : $P{NUMBERFORMAT}.toPattern()]]></patternExpression>
-			</textField>
-			<line>
-				<reportElement x="235" y="57" width="320" height="3" uuid="382bf123-c27c-426b-a320-1a2df3a239e9"/>
-			</line>
-		</band>
-	</summary>
 </jasperReport>