Merge change from pi
authorIván Perdomo <ivan.perdomo@openbravo.com>
Mon, 07 Nov 2011 14:22:37 +0100
changeset 14528 edfb45ee4d9a
parent 14526 cedf3b81d348 (current diff)
parent 14205 9119d097691b (diff)
child 14529 114e4be5ae78
child 14553 d0d0e20a7802
Merge change from pi
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_FIELD.xml
Binary file modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/LinkCreditPayments.class has changed
Binary file modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/LinkCreditPaymentsData.class has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/LinkCreditPayments.java	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,100 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+package org.openbravo.advpaymentmngt.modulescript;
+
+import java.math.BigDecimal;
+
+import javax.servlet.ServletException;
+
+import org.apache.log4j.Logger;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.modulescript.ModuleScript;
+
+public class LinkCreditPayments extends ModuleScript {
+  private static final Logger log4j = Logger.getLogger(LinkCreditPayments.class);
+
+  @Override
+  public void execute() {
+    try {
+      ConnectionProvider cp = getConnectionProvider();
+
+      final LinkCreditPaymentsData[] bPartners = LinkCreditPaymentsData.selectBusinessPartners(cp);
+      for (int i = 0; i < bPartners.length; i++) {
+        linkCreditPayments(cp, bPartners[i].cBpartnerId, bPartners[i].name, "Y");
+        linkCreditPayments(cp, bPartners[i].cBpartnerId, bPartners[i].name, "N");
+      }
+    } catch (Exception e) {
+      handleError(e);
+    }
+
+  }
+
+  private void linkCreditPayments(ConnectionProvider cp, String cbPartnerId, String cbPartnerName,
+      String isReceipt) throws ServletException {
+    LinkCreditPaymentsData[] paymentsUsingCredit = LinkCreditPaymentsData
+        .selectPaymentsUsingCredit(cp, isReceipt, cbPartnerId);
+    LinkCreditPaymentsData[] creditPayments = LinkCreditPaymentsData
+        .selectPaymentsGeneratingCredit(cp, isReceipt, cbPartnerId);
+    if (paymentsUsingCredit.length > 0 && creditPayments.length > 0) {
+      log4j.info("Linking Credit Payments for business Partner: " + cbPartnerName);
+      linkCreditPayment(cp, paymentsUsingCredit, creditPayments);
+    }
+  }
+
+  private void linkCreditPayment(ConnectionProvider cp,
+      LinkCreditPaymentsData[] paymentsUsingCredit, LinkCreditPaymentsData[] creditPayments)
+      throws ServletException {
+    int j = 0;
+    BigDecimal availableCreditPayment = new BigDecimal(creditPayments[j].usedCredit);
+    for (int i = 0; i < paymentsUsingCredit.length; i++) {
+      BigDecimal consumedCredit = new BigDecimal(paymentsUsingCredit[i].usedCredit);
+      while (j < creditPayments.length && consumedCredit.compareTo(BigDecimal.ZERO) > 0) {
+        log4j.info("Payment Using Credit: " + paymentsUsingCredit[i].documentno
+            + ". Pending amount to distribute: " + consumedCredit);
+        if (availableCreditPayment.compareTo(BigDecimal.ZERO) == 0) {
+          availableCreditPayment = new BigDecimal(creditPayments[j].usedCredit);
+        }
+        if (availableCreditPayment.compareTo(consumedCredit) >= 0) {
+          log4j.info("linking with credit payment " + creditPayments[j].documentno + ", amount: "
+              + consumedCredit);
+          LinkCreditPaymentsData.insertUsedCreditSource(cp, paymentsUsingCredit[i].adClientId,
+              paymentsUsingCredit[i].adOrgId, paymentsUsingCredit[i].finPaymentId,
+              creditPayments[j].finPaymentId, consumedCredit.toString(),
+              creditPayments[j].cCurrencyId);
+          availableCreditPayment = availableCreditPayment.subtract(consumedCredit);
+          consumedCredit = BigDecimal.ZERO;
+          log4j.info("(available credit in the payment: " + availableCreditPayment + ") ");
+        } else {
+          log4j.info("linking with credit payment " + creditPayments[j].documentno + ", amount: "
+              + availableCreditPayment);
+          LinkCreditPaymentsData.insertUsedCreditSource(cp, paymentsUsingCredit[i].adClientId,
+              paymentsUsingCredit[i].adOrgId, paymentsUsingCredit[i].finPaymentId,
+              creditPayments[j].finPaymentId, availableCreditPayment.toString(),
+              creditPayments[j].cCurrencyId);
+          consumedCredit = consumedCredit.subtract(availableCreditPayment);
+          availableCreditPayment = BigDecimal.ZERO;
+          log4j.info("(credit payment has been fully used)");
+        }
+        if (availableCreditPayment.compareTo(BigDecimal.ZERO) == 0) {
+          j++;
+        }
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/LinkCreditPayments_data.xsql	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+-->
+<SqlClass name="LinkCreditPaymentsData" package="org.openbravo.advpaymentmngt.modulescript">
+  <SqlClassComment></SqlClassComment>
+  <SqlMethod name="selectPaymentsUsingCredit" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT FIN_PAYMENT_ID, USED_CREDIT, C_CURRENCY_ID, AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, DOCUMENTNO, '' AS NAME
+        FROM FIN_PAYMENT P
+        WHERE NOT EXISTS (SELECT 1 
+                          FROM FIN_PAYMENT_CREDIT PC
+                          WHERE PC.FIN_PAYMENT_ID = P.FIN_PAYMENT_ID
+                          )       
+        AND P.GENERATED_CREDIT = 0 AND P.USED_CREDIT > 0
+        AND P.ISRECEIPT = ?
+        AND P.C_BPARTNER_ID = ?
+        ORDER BY P.PAYMENTDATE, P.DOCUMENTNO
+      ]]>
+    </Sql>
+    <Parameter name="isReceipt"/>
+    <Parameter name="cbPartnerId"/>
+  </SqlMethod>
+  <SqlMethod name="selectPaymentsGeneratingCredit" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT FIN_PAYMENT_ID, USED_CREDIT, C_CURRENCY_ID, DOCUMENTNO
+        FROM FIN_PAYMENT P
+        WHERE GENERATED_CREDIT > 0 AND USED_CREDIT > 0
+        AND ISRECEIPT = ?
+        AND C_BPARTNER_ID = ?
+        ORDER BY PAYMENTDATE, DOCUMENTNO
+      ]]>
+    </Sql>
+    <Parameter name="isReceipt"/>
+    <Parameter name="cbPartnerId"/>
+  </SqlMethod>
+  <SqlMethod name="insertUsedCreditSource" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        INSERT INTO fin_payment_credit(
+            fin_payment_credit_id, ad_client_id, ad_org_id, created, createdby, 
+            updated, updatedby, isactive, fin_payment_id, fin_payment_id_used, 
+            amount, c_currency_id)
+        VALUES (get_uuid(), ?, ?, now(), '100',
+                now(), '100', 'Y', ?, ?, 
+                TO_NUMBER( ? ), ?)
+        
+      ]]>
+    </Sql>
+    <Parameter name="clientId"/>
+    <Parameter name="orgId"/>
+    <Parameter name="paymentId"/>
+    <Parameter name="creditpaymentId"/>
+    <Parameter name="amount"/>
+    <Parameter name="currencyId"/>
+  </SqlMethod>
+  <SqlMethod name="selectBusinessPartners" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        SELECT C_BPARTNER_ID, NAME
+        FROM C_BPARTNER BP
+        WHERE EXISTS (SELECT 1
+                      FROM FIN_PAYMENT P
+                      WHERE P.C_BPARTNER_ID = BP.C_BPARTNER_ID)
+      ]]>
+    </Sql>
+  </SqlMethod>
+</SqlClass>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/src/org/openbravo/advpaymentmngt/modulescript/LinkCreditPaymentsData.java	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,288 @@
+//Sqlc generated V1.O00-1
+package org.openbravo.advpaymentmngt.modulescript;
+
+import java.sql.*;
+
+import org.apache.log4j.Logger;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.data.FieldProvider;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.data.UtilSql;
+import java.util.*;
+
+class LinkCreditPaymentsData implements FieldProvider {
+static Logger log4j = Logger.getLogger(LinkCreditPaymentsData.class);
+  private String InitRecordNumber="0";
+  public String finPaymentId;
+  public String usedCredit;
+  public String cCurrencyId;
+  public String adClientId;
+  public String adOrgId;
+  public String cBpartnerId;
+  public String documentno;
+  public String name;
+
+  public String getInitRecordNumber() {
+    return InitRecordNumber;
+  }
+
+  public String getField(String fieldName) {
+    if (fieldName.equalsIgnoreCase("fin_payment_id") || fieldName.equals("finPaymentId"))
+      return finPaymentId;
+    else if (fieldName.equalsIgnoreCase("used_credit") || fieldName.equals("usedCredit"))
+      return usedCredit;
+    else if (fieldName.equalsIgnoreCase("c_currency_id") || fieldName.equals("cCurrencyId"))
+      return cCurrencyId;
+    else if (fieldName.equalsIgnoreCase("ad_client_id") || fieldName.equals("adClientId"))
+      return adClientId;
+    else if (fieldName.equalsIgnoreCase("ad_org_id") || fieldName.equals("adOrgId"))
+      return adOrgId;
+    else if (fieldName.equalsIgnoreCase("c_bpartner_id") || fieldName.equals("cBpartnerId"))
+      return cBpartnerId;
+    else if (fieldName.equalsIgnoreCase("documentno"))
+      return documentno;
+    else if (fieldName.equalsIgnoreCase("name"))
+      return name;
+   else {
+     log4j.debug("Field does not exist: " + fieldName);
+     return null;
+   }
+ }
+
+  public static LinkCreditPaymentsData[] selectPaymentsUsingCredit(ConnectionProvider connectionProvider, String isReceipt, String cbPartnerId)    throws ServletException {
+    return selectPaymentsUsingCredit(connectionProvider, isReceipt, cbPartnerId, 0, 0);
+  }
+
+  public static LinkCreditPaymentsData[] selectPaymentsUsingCredit(ConnectionProvider connectionProvider, String isReceipt, String cbPartnerId, int firstRegister, int numberRegisters)    throws ServletException {
+    String strSql = "";
+    strSql = strSql + 
+      "        SELECT FIN_PAYMENT_ID, USED_CREDIT, C_CURRENCY_ID, AD_CLIENT_ID, AD_ORG_ID, C_BPARTNER_ID, DOCUMENTNO, '' AS NAME" +
+      "        FROM FIN_PAYMENT P" +
+      "        WHERE NOT EXISTS (SELECT 1 " +
+      "                          FROM FIN_PAYMENT_CREDIT PC" +
+      "                          WHERE PC.FIN_PAYMENT_ID = P.FIN_PAYMENT_ID" +
+      "                          )       " +
+      "        AND P.GENERATED_CREDIT = 0 AND P.USED_CREDIT > 0" +
+      "        AND P.ISRECEIPT = ?" +
+      "        AND P.C_BPARTNER_ID = ?" +
+      "        ORDER BY P.PAYMENTDATE, P.DOCUMENTNO";
+
+    ResultSet result;
+    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
+    PreparedStatement st = null;
+
+    int iParameter = 0;
+    try {
+    st = connectionProvider.getPreparedStatement(strSql);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, isReceipt);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, cbPartnerId);
+
+      result = st.executeQuery();
+      long countRecord = 0;
+      long countRecordSkip = 1;
+      boolean continueResult = true;
+      while(countRecordSkip < firstRegister && continueResult) {
+        continueResult = result.next();
+        countRecordSkip++;
+      }
+      while(continueResult && result.next()) {
+        countRecord++;
+        LinkCreditPaymentsData objectLinkCreditPaymentsData = new LinkCreditPaymentsData();
+        objectLinkCreditPaymentsData.finPaymentId = UtilSql.getValue(result, "fin_payment_id");
+        objectLinkCreditPaymentsData.usedCredit = UtilSql.getValue(result, "used_credit");
+        objectLinkCreditPaymentsData.cCurrencyId = UtilSql.getValue(result, "c_currency_id");
+        objectLinkCreditPaymentsData.adClientId = UtilSql.getValue(result, "ad_client_id");
+        objectLinkCreditPaymentsData.adOrgId = UtilSql.getValue(result, "ad_org_id");
+        objectLinkCreditPaymentsData.cBpartnerId = UtilSql.getValue(result, "c_bpartner_id");
+        objectLinkCreditPaymentsData.documentno = UtilSql.getValue(result, "documentno");
+        objectLinkCreditPaymentsData.name = UtilSql.getValue(result, "name");
+        objectLinkCreditPaymentsData.InitRecordNumber = Integer.toString(firstRegister);
+        vector.addElement(objectLinkCreditPaymentsData);
+        if (countRecord >= numberRegisters && numberRegisters != 0) {
+          continueResult = false;
+        }
+      }
+      result.close();
+    } catch(SQLException e){
+      log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
+      throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
+    } catch(Exception ex){
+      log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
+      throw new ServletException("@CODE=@" + ex.getMessage());
+    } finally {
+      try {
+        connectionProvider.releasePreparedStatement(st);
+      } catch(Exception ignore){
+        ignore.printStackTrace();
+      }
+    }
+    LinkCreditPaymentsData objectLinkCreditPaymentsData[] = new LinkCreditPaymentsData[vector.size()];
+    vector.copyInto(objectLinkCreditPaymentsData);
+    return(objectLinkCreditPaymentsData);
+  }
+
+  public static LinkCreditPaymentsData[] selectPaymentsGeneratingCredit(ConnectionProvider connectionProvider, String isReceipt, String cbPartnerId)    throws ServletException {
+    return selectPaymentsGeneratingCredit(connectionProvider, isReceipt, cbPartnerId, 0, 0);
+  }
+
+  public static LinkCreditPaymentsData[] selectPaymentsGeneratingCredit(ConnectionProvider connectionProvider, String isReceipt, String cbPartnerId, int firstRegister, int numberRegisters)    throws ServletException {
+    String strSql = "";
+    strSql = strSql + 
+      "        SELECT FIN_PAYMENT_ID, USED_CREDIT, C_CURRENCY_ID, DOCUMENTNO" +
+      "        FROM FIN_PAYMENT P" +
+      "        WHERE GENERATED_CREDIT > 0 AND USED_CREDIT > 0" +
+      "        AND ISRECEIPT = ?" +
+      "        AND C_BPARTNER_ID = ?" +
+      "        ORDER BY PAYMENTDATE, DOCUMENTNO";
+
+    ResultSet result;
+    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
+    PreparedStatement st = null;
+
+    int iParameter = 0;
+    try {
+    st = connectionProvider.getPreparedStatement(strSql);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, isReceipt);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, cbPartnerId);
+
+      result = st.executeQuery();
+      long countRecord = 0;
+      long countRecordSkip = 1;
+      boolean continueResult = true;
+      while(countRecordSkip < firstRegister && continueResult) {
+        continueResult = result.next();
+        countRecordSkip++;
+      }
+      while(continueResult && result.next()) {
+        countRecord++;
+        LinkCreditPaymentsData objectLinkCreditPaymentsData = new LinkCreditPaymentsData();
+        objectLinkCreditPaymentsData.finPaymentId = UtilSql.getValue(result, "fin_payment_id");
+        objectLinkCreditPaymentsData.usedCredit = UtilSql.getValue(result, "used_credit");
+        objectLinkCreditPaymentsData.cCurrencyId = UtilSql.getValue(result, "c_currency_id");
+        objectLinkCreditPaymentsData.documentno = UtilSql.getValue(result, "documentno");
+        objectLinkCreditPaymentsData.InitRecordNumber = Integer.toString(firstRegister);
+        vector.addElement(objectLinkCreditPaymentsData);
+        if (countRecord >= numberRegisters && numberRegisters != 0) {
+          continueResult = false;
+        }
+      }
+      result.close();
+    } catch(SQLException e){
+      log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
+      throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
+    } catch(Exception ex){
+      log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
+      throw new ServletException("@CODE=@" + ex.getMessage());
+    } finally {
+      try {
+        connectionProvider.releasePreparedStatement(st);
+      } catch(Exception ignore){
+        ignore.printStackTrace();
+      }
+    }
+    LinkCreditPaymentsData objectLinkCreditPaymentsData[] = new LinkCreditPaymentsData[vector.size()];
+    vector.copyInto(objectLinkCreditPaymentsData);
+    return(objectLinkCreditPaymentsData);
+  }
+
+  public static int insertUsedCreditSource(ConnectionProvider connectionProvider, String clientId, String orgId, String paymentId, String creditpaymentId, String amount, String currencyId)    throws ServletException {
+    String strSql = "";
+    strSql = strSql + 
+      "        INSERT INTO fin_payment_credit(" +
+      "            fin_payment_credit_id, ad_client_id, ad_org_id, created, createdby, " +
+      "            updated, updatedby, isactive, fin_payment_id, fin_payment_id_used, " +
+      "            amount, c_currency_id)" +
+      "        VALUES (get_uuid(), ?, ?, now(), '100'," +
+      "                now(), '100', 'Y', ?, ?, " +
+      "                TO_NUMBER( ? ), ?)";
+
+    int updateCount = 0;
+    PreparedStatement st = null;
+
+    int iParameter = 0;
+    try {
+    st = connectionProvider.getPreparedStatement(strSql);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, clientId);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, orgId);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, paymentId);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, creditpaymentId);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, amount);
+      iParameter++; UtilSql.setValue(st, iParameter, 12, null, currencyId);
+
+      updateCount = st.executeUpdate();
+    } catch(SQLException e){
+      log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
+      throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
+    } catch(Exception ex){
+      log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
+      throw new ServletException("@CODE=@" + ex.getMessage());
+    } finally {
+      try {
+        connectionProvider.releasePreparedStatement(st);
+      } catch(Exception ignore){
+        ignore.printStackTrace();
+      }
+    }
+    return(updateCount);
+  }
+
+  public static LinkCreditPaymentsData[] selectBusinessPartners(ConnectionProvider connectionProvider)    throws ServletException {
+    return selectBusinessPartners(connectionProvider, 0, 0);
+  }
+
+  public static LinkCreditPaymentsData[] selectBusinessPartners(ConnectionProvider connectionProvider, int firstRegister, int numberRegisters)    throws ServletException {
+    String strSql = "";
+    strSql = strSql + 
+      "        SELECT C_BPARTNER_ID, NAME" +
+      "        FROM C_BPARTNER BP" +
+      "        WHERE EXISTS (SELECT 1" +
+      "                      FROM FIN_PAYMENT P" +
+      "                      WHERE P.C_BPARTNER_ID = BP.C_BPARTNER_ID)";
+
+    ResultSet result;
+    Vector<java.lang.Object> vector = new Vector<java.lang.Object>(0);
+    PreparedStatement st = null;
+
+    try {
+    st = connectionProvider.getPreparedStatement(strSql);
+
+      result = st.executeQuery();
+      long countRecord = 0;
+      long countRecordSkip = 1;
+      boolean continueResult = true;
+      while(countRecordSkip < firstRegister && continueResult) {
+        continueResult = result.next();
+        countRecordSkip++;
+      }
+      while(continueResult && result.next()) {
+        countRecord++;
+        LinkCreditPaymentsData objectLinkCreditPaymentsData = new LinkCreditPaymentsData();
+        objectLinkCreditPaymentsData.cBpartnerId = UtilSql.getValue(result, "c_bpartner_id");
+        objectLinkCreditPaymentsData.name = UtilSql.getValue(result, "name");
+        objectLinkCreditPaymentsData.InitRecordNumber = Integer.toString(firstRegister);
+        vector.addElement(objectLinkCreditPaymentsData);
+        if (countRecord >= numberRegisters && numberRegisters != 0) {
+          continueResult = false;
+        }
+      }
+      result.close();
+    } catch(SQLException e){
+      log4j.error("SQL error in query: " + strSql + "Exception:"+ e);
+      throw new ServletException("@CODE=" + Integer.toString(e.getErrorCode()) + "@" + e.getMessage());
+    } catch(Exception ex){
+      log4j.error("Exception in query: " + strSql + "Exception:"+ ex);
+      throw new ServletException("@CODE=@" + ex.getMessage());
+    } finally {
+      try {
+        connectionProvider.releasePreparedStatement(st);
+      } catch(Exception ignore){
+        ignore.printStackTrace();
+      }
+    }
+    LinkCreditPaymentsData objectLinkCreditPaymentsData[] = new LinkCreditPaymentsData[vector.size()];
+    vector.copyInto(objectLinkCreditPaymentsData);
+    return(objectLinkCreditPaymentsData);
+  }
+}
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Mon Nov 07 14:22:37 2011 +0100
@@ -21,7 +21,9 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 
@@ -32,16 +34,19 @@
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
 import org.openbravo.advpaymentmngt.process.FIN_AddPayment;
+import org.openbravo.advpaymentmngt.process.FIN_PaymentProcess;
 import org.openbravo.advpaymentmngt.utility.FIN_Utility;
 import org.openbravo.base.filter.IsIDFilter;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBDao;
 import org.openbravo.data.FieldProvider;
 import org.openbravo.erpCommon.ad_actionButton.ActionButtonUtility;
 import org.openbravo.erpCommon.reference.PInstanceProcessData;
+import org.openbravo.erpCommon.utility.FieldProviderFactory;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.process.ProcessInstance;
@@ -60,10 +65,13 @@
 public class ProcessInvoice extends HttpSecureAppServlet {
   private static final long serialVersionUID = 1L;
 
+  private List<FIN_Payment> creditPayments = new ArrayList<FIN_Payment>();
+  private final AdvPaymentMngtDao dao = new AdvPaymentMngtDao();
+
   public void doPost(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
     VariablesSecureApp vars = new VariablesSecureApp(request);
-    AdvPaymentMngtDao dao = new AdvPaymentMngtDao();
+
     if (vars.commandIn("DEFAULT")) {
       final String strWindowId = vars.getGlobalVariable("inpwindowId", "ProcessInvoice|Window_ID",
           IsIDFilter.instance);
@@ -105,6 +113,9 @@
       final String strC_Invoice_ID = vars.getGlobalVariable("inpKey",
           strWindowId + "|C_Invoice_ID", "");
       final String strdocaction = vars.getStringParameter("inpdocaction");
+      final String strOrg = vars.getGlobalVariable("inpadOrgId", "ProcessInvoice|Org_ID",
+          IsIDFilter.instance);
+
       OBError myMessage = null;
       try {
 
@@ -124,9 +135,27 @@
         final ProcessInstance pinstance = CallProcess.getInstance().call(process, strC_Invoice_ID,
             null);
 
-        // invoice = dao.getObject(Invoice.class, strC_Invoice_ID);
         OBDal.getInstance().getSession().refresh(invoice);
         invoice.setAPRMProcessinvoice(invoice.getDocumentAction());
+        // Remove invoice's used credit description
+        if ("RE".equals(strdocaction) && pinstance.getResult() != 0L) {
+          final String invDesc = invoice.getDescription();
+          if (invDesc != null) {
+            final String creditMsg = Utility.messageBD(this, "APRM_InvoiceDescUsedCredit",
+                vars.getLanguage());
+            if (creditMsg != null) {
+              final StringBuffer newDesc = new StringBuffer();
+              for (final String line : invDesc.split("\n")) {
+                if (!line.startsWith(creditMsg.substring(0, creditMsg.lastIndexOf("%s")))) {
+                  newDesc.append(line);
+                  if (!"".equals(line))
+                    newDesc.append("\n");
+                }
+              }
+              invoice.setDescription(newDesc.toString());
+            }
+          }
+        }
         OBDal.getInstance().save(invoice);
         OBDal.getInstance().flush();
         OBDal.getInstance().commitAndClose();
@@ -148,6 +177,32 @@
           OBContext.restorePreviousMode();
         }
 
+        if ("CO".equals(strdocaction)) {
+          // Need to refresh the invoice again from the db
+          invoice = dao.getObject(Invoice.class, strC_Invoice_ID);
+          final String invoiceDocCategory = invoice.getDocumentType().getDocumentCategory();
+          /*
+           * Print a grid popup in case of credit payment
+           */
+          // If the invoice grand total is ZERO or already has payments (due to
+          // payment method automation) or the business partner does not have a default financial
+          // account defined or invoice's payment method is not inside BP's financial
+          // account do not cancel credit
+          if (BigDecimal.ZERO.compareTo(invoice.getGrandTotalAmount()) != 0
+              && isPaymentMethodConfigured(invoice) && !isInvoiceWithPayments(invoice)
+              && ("API".equals(invoiceDocCategory) || "ARI".equals(invoiceDocCategory))) {
+            creditPayments = dao.getCustomerPaymentsWithCredit(invoice.getOrganization(),
+                invoice.getBusinessPartner(), invoice.isSalesTransaction());
+            if (creditPayments != null && !creditPayments.isEmpty()) {
+              printPageCreditPaymentGrid(response, vars, strC_Invoice_ID, strdocaction, strTabId,
+                  strC_Invoice_ID, strdocaction, strWindowId, strTabId, invoice.getInvoiceDate(),
+                  strOrg);
+            }
+          }
+
+          executePayments(response, vars, strWindowId, strTabId, strC_Invoice_ID, strOrg);
+        }
+
       } catch (ServletException ex) {
         myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
         if (!myMessage.isConnectionAvailable()) {
@@ -157,80 +212,125 @@
           vars.setMessage(strTabId, myMessage);
       }
 
+    } else if (vars.commandIn("GRIDLIST")) {
+      final String strWindowId = vars.getGlobalVariable("inpwindowId", "ProcessInvoice|Window_ID",
+          IsIDFilter.instance);
+      final String strC_Invoice_ID = vars.getGlobalVariable("inpKey",
+          strWindowId + "|C_Invoice_ID", "", IsIDFilter.instance);
+
+      printGrid(response, vars, strC_Invoice_ID);
+    } else if (vars.commandIn("USECREDITPAYMENTS") || vars.commandIn("CANCEL_USECREDITPAYMENTS")) {
+      final String strWindowId = vars.getGlobalVariable("inpwindowId", "ProcessInvoice|Window_ID",
+          IsIDFilter.instance);
+      final String strTabId = vars.getGlobalVariable("inpTabId", "ProcessInvoice|Tab_ID",
+          IsIDFilter.instance);
+      final String strC_Invoice_ID = vars.getGlobalVariable("inpKey",
+          strWindowId + "|C_Invoice_ID", "");
+      final String strPaymentDate = vars.getRequiredStringParameter("inpPaymentDate");
+      final String strOrg = vars.getGlobalVariable("inpadOrgId", "ProcessInvoice|Org_ID",
+          IsIDFilter.instance);
+
+      final String strCreditPaymentIds;
+      if (vars.commandIn("CANCEL_USECREDITPAYMENTS")) {
+        strCreditPaymentIds = null;
+      } else {
+        strCreditPaymentIds = vars.getInParameter("inpCreditPaymentId", IsIDFilter.instance);
+      }
+
       /*
-       * Cancel credit (if any) for the invoice's bp
+       * Use credit logic
        */
-      if ("CO".equals(strdocaction)) {
+      if (strCreditPaymentIds != null && !strCreditPaymentIds.isEmpty()) {
+        List<FIN_Payment> selectedCreditPayment = FIN_Utility.getOBObjectList(FIN_Payment.class,
+            strCreditPaymentIds);
+        HashMap<String, BigDecimal> selectedCreditPaymentAmounts = FIN_AddPayment
+            .getSelectedBaseOBObjectAmount(vars, selectedCreditPayment, "inpPaymentAmount");
         try {
           OBContext.setAdminMode(true);
           final Invoice invoice = OBDal.getInstance().get(Invoice.class, strC_Invoice_ID);
-          final String invoiceDocCategory = invoice.getDocumentType().getDocumentCategory();
-          if ("API".equals(invoiceDocCategory) || "ARI".equals(invoiceDocCategory)) {
-            final FIN_Payment creditPayment = dao.getCreditPayment(invoice);
-            // If the invoice grand total is ZERO or already has payments (due to
-            // payment method automation) or the business partner does not have a default financial
-            // account defined or invoice's payment method is not inside BP's financial
-            // account do not cancel credit
-            if (creditPayment != null
-                && BigDecimal.ZERO.compareTo(invoice.getGrandTotalAmount()) != 0
-                && isPaymentMethodConfigured(invoice) && !isInvoiceWithPayments(invoice)) {
-              log4j.info("Detected credit payment: " + creditPayment.getIdentifier()
-                  + ", that matches the invoice: " + invoice.getIdentifier());
-              // Set Used Credit = Invoice's Grand Total Amount
-              creditPayment.setUsedCredit(invoice.getGrandTotalAmount());
-              final StringBuffer description = new StringBuffer();
-              if (creditPayment.getDescription() != null
-                  && !creditPayment.getDescription().equals(""))
-                description.append(creditPayment.getDescription()).append("\n");
-              description.append(String.format(
-                  Utility.messageBD(this, "APRM_CreditUsedinInvoice", vars.getLanguage()),
-                  invoice.getDocumentNo()));
-              creditPayment.setDescription(description.toString());
 
-              final List<FIN_PaymentScheduleDetail> paymentScheduleDetails = new ArrayList<FIN_PaymentScheduleDetail>();
-              final HashMap<String, BigDecimal> paymentScheduleDetailsAmounts = new HashMap<String, BigDecimal>();
-              for (final FIN_PaymentSchedule paymentSchedule : invoice.getFINPaymentScheduleList()) {
-                for (final FIN_PaymentScheduleDetail paymentScheduleDetail : paymentSchedule
-                    .getFINPaymentScheduleDetailInvoicePaymentScheduleList()) {
-                  paymentScheduleDetails.add(paymentScheduleDetail);
-                  paymentScheduleDetailsAmounts.put(paymentScheduleDetail.getId(),
-                      paymentScheduleDetail.getAmount());
-                }
+          final StringBuffer creditPaymentsIdentifiers = new StringBuffer();
+          BigDecimal totalUsedCreditAmt = BigDecimal.ZERO;
+          for (final FIN_Payment creditPayment : selectedCreditPayment) {
+            final BigDecimal usedCreditAmt = selectedCreditPaymentAmounts
+                .get(creditPayment.getId());
+            // Set Used Credit = Amount + Previous used credit introduced by the user
+            creditPayment.setUsedCredit(usedCreditAmt.add(creditPayment.getUsedCredit()));
+            final StringBuffer description = new StringBuffer();
+            if (creditPayment.getDescription() != null
+                && !creditPayment.getDescription().equals(""))
+              description.append(creditPayment.getDescription()).append("\n");
+            description.append(String.format(
+                Utility.messageBD(this, "APRM_CreditUsedinInvoice", vars.getLanguage()),
+                invoice.getDocumentNo()));
+            creditPayment.setDescription(description.toString());
+            totalUsedCreditAmt = totalUsedCreditAmt.add(usedCreditAmt);
+            creditPaymentsIdentifiers.append(creditPayment.getDocumentNo());
+            creditPaymentsIdentifiers.append(", ");
+          }
+          creditPaymentsIdentifiers.delete(creditPaymentsIdentifiers.length() - 2,
+              creditPaymentsIdentifiers.length());
+          creditPaymentsIdentifiers.append("\n");
+
+          final List<FIN_PaymentScheduleDetail> paymentScheduleDetails = new ArrayList<FIN_PaymentScheduleDetail>();
+          final HashMap<String, BigDecimal> paymentScheduleDetailsAmounts = new HashMap<String, BigDecimal>();
+          BigDecimal allocatedAmt = BigDecimal.ZERO;
+          for (final FIN_PaymentScheduleDetail paymentScheduleDetail : dao
+              .getInvoicePendingScheduledPaymentDetails(invoice)) {
+            if (totalUsedCreditAmt.compareTo(allocatedAmt) > 0) {
+              final BigDecimal pendingToAllocate = totalUsedCreditAmt.subtract(allocatedAmt);
+              paymentScheduleDetails.add(paymentScheduleDetail);
+
+              final BigDecimal psdAmt = paymentScheduleDetail.getAmount();
+              if (psdAmt.compareTo(pendingToAllocate) <= 0) {
+                paymentScheduleDetailsAmounts.put(paymentScheduleDetail.getId(), psdAmt);
+                allocatedAmt = allocatedAmt.add(psdAmt);
+              } else {
+                paymentScheduleDetailsAmounts.put(paymentScheduleDetail.getId(), pendingToAllocate);
+                allocatedAmt = allocatedAmt.add(pendingToAllocate);
               }
-
-              // Create new Payment
-              final boolean isSalesTransaction = invoice.isSalesTransaction();
-              final DocumentType docType = FIN_Utility.getDocumentType(invoice.getOrganization(),
-                  isSalesTransaction ? "ARR" : "APP");
-              final String strPaymentDocumentNo = FIN_Utility.getDocumentNo(docType,
-                  docType.getTable() != null ? docType.getTable().getDBTableName() : "");
-              final FIN_FinancialAccount bpFinAccount = isSalesTransaction ? invoice
-                  .getBusinessPartner().getAccount() : invoice.getBusinessPartner()
-                  .getPOFinancialAccount();
-              final FIN_Payment newPayment = FIN_AddPayment.savePayment(null, isSalesTransaction,
-                  docType, strPaymentDocumentNo, invoice.getBusinessPartner(),
-                  invoice.getPaymentMethod(), bpFinAccount, "0", creditPayment.getPaymentDate(),
-                  invoice.getOrganization(), invoice.getDocumentNo(), paymentScheduleDetails,
-                  paymentScheduleDetailsAmounts, false, false);
-              newPayment.setAmount(BigDecimal.ZERO);
-              newPayment.setGeneratedCredit(BigDecimal.ZERO);
-              newPayment.setUsedCredit(invoice.getGrandTotalAmount());
-
-              // Process the new payment
-              FIN_AddPayment.processPayment(vars, this, "P", newPayment);
-
-              // Update Invoice's description
-              final StringBuffer invDesc = new StringBuffer();
-              if (invoice.getDescription() != null) {
-                invDesc.append(invoice.getDescription());
-                invDesc.append("\n");
-              }
-              invDesc.append(String.format(
-                  Utility.messageBD(this, "APRM_InvoiceDescUsedCredit", vars.getLanguage()),
-                  creditPayment.getIdentifier()));
-              invoice.setDescription(invDesc.toString());
             }
           }
+
+          // Create new Payment
+          final boolean isSalesTransaction = invoice.isSalesTransaction();
+          final DocumentType docType = FIN_Utility.getDocumentType(invoice.getOrganization(),
+              isSalesTransaction ? "ARR" : "APP");
+          final String strPaymentDocumentNo = FIN_Utility.getDocumentNo(docType,
+              docType.getTable() != null ? docType.getTable().getDBTableName() : "");
+          final FIN_FinancialAccount bpFinAccount = isSalesTransaction ? invoice
+              .getBusinessPartner().getAccount() : invoice.getBusinessPartner()
+              .getPOFinancialAccount();
+          final FIN_Payment newPayment = FIN_AddPayment.savePayment(null, isSalesTransaction,
+              docType, strPaymentDocumentNo, invoice.getBusinessPartner(),
+              invoice.getPaymentMethod(), bpFinAccount, "0", FIN_Utility.getDate(strPaymentDate),
+              invoice.getOrganization(), invoice.getDocumentNo(), paymentScheduleDetails,
+              paymentScheduleDetailsAmounts, false, false);
+          newPayment.setAmount(BigDecimal.ZERO);
+          newPayment.setGeneratedCredit(BigDecimal.ZERO);
+          newPayment.setUsedCredit(totalUsedCreditAmt);
+
+          // Link new Payment with the credit payments used
+          for (final FIN_Payment creditPayment : selectedCreditPayment) {
+            final BigDecimal usedCreditAmt = selectedCreditPaymentAmounts
+                .get(creditPayment.getId());
+            FIN_PaymentProcess.linkCreditPayment(newPayment, usedCreditAmt, creditPayment);
+          }
+
+          // Process the new payment
+          FIN_AddPayment.processPayment(vars, this, "P", newPayment);
+
+          // Update Invoice's description
+          final StringBuffer invDesc = new StringBuffer();
+          if (invoice.getDescription() != null) {
+            invDesc.append(invoice.getDescription());
+            invDesc.append("\n");
+          }
+          invDesc.append(String.format(
+              Utility.messageBD(this, "APRM_InvoiceDescUsedCredit", vars.getLanguage()),
+              creditPaymentsIdentifiers.toString()));
+          invoice.setDescription(invDesc.toString());
+
         } catch (final Exception e) {
           log4j.error("Exception while canceling the credit in the invoice: " + strC_Invoice_ID);
           e.printStackTrace();
@@ -238,37 +338,41 @@
           OBContext.restorePreviousMode();
         }
       }
+      executePayments(response, vars, strWindowId, strTabId, strC_Invoice_ID, strOrg);
+    }
+  }
 
-      List<FIN_Payment> payments = null;
-      try {
-        OBContext.setAdminMode(true);
-        payments = dao.getPendingExecutionPayments(strC_Invoice_ID);
-      } finally {
-        OBContext.restorePreviousMode();
-      }
+  private void executePayments(HttpServletResponse response, VariablesSecureApp vars,
+      final String strWindowId, final String strTabId, final String strC_Invoice_ID,
+      final String strOrg) throws IOException, ServletException {
+    OBError myMessage = new OBError();
 
-      if (payments != null && payments.size() > 0) {
-        vars.setSessionValue("ExecutePayments|Window_ID", strWindowId);
-        vars.setSessionValue("ExecutePayments|Tab_ID", strTabId);
-        vars.setSessionValue("ExecutePayments|Org_ID",
-            vars.getSessionValue("ProcessInvoice|Org_ID"));
-        vars.setSessionValue("ExecutePayments|payments", FIN_Utility.getInStrList(payments));
-        if (myMessage != null)
-          vars.setMessage("ExecutePayments|message", myMessage);
-        response.sendRedirect(strDireccion
-            + "/org.openbravo.advpaymentmngt.ad_actionbutton/ExecutePayments.html");
-      } else {
-        String strWindowPath = Utility.getTabURL(strTabId, "R", true);
-        if (strWindowPath.equals(""))
-          strWindowPath = strDefaultServlet;
-        printPageClosePopUp(response, vars, strWindowPath);
-      }
+    List<FIN_Payment> payments = null;
+    try {
+      OBContext.setAdminMode(true);
+      payments = dao.getPendingExecutionPayments(strC_Invoice_ID);
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    if (payments != null && payments.size() > 0) {
+      vars.setSessionValue("ExecutePayments|Window_ID", strWindowId);
+      vars.setSessionValue("ExecutePayments|Tab_ID", strTabId);
+      vars.setSessionValue("ExecutePayments|Org_ID", strOrg);
+      vars.setSessionValue("ExecutePayments|payments", FIN_Utility.getInStrList(payments));
+      if (myMessage != null)
+        vars.setMessage("ExecutePayments|message", myMessage);
+      response.sendRedirect(strDireccion
+          + "/org.openbravo.advpaymentmngt.ad_actionbutton/ExecutePayments.html");
+    } else {
+      String strWindowPath = Utility.getTabURL(strTabId, "R", true);
+      if (strWindowPath.equals(""))
+        strWindowPath = strDefaultServlet;
+      printPageClosePopUp(response, vars, strWindowPath);
+    }
 
-      vars.removeSessionValue("ProcessInvoice|Window_ID");
-      vars.removeSessionValue("ProcessInvoice|Tab_ID");
-      vars.removeSessionValue("ProcessInvoice|Org_ID");
-
-    }
+    vars.removeSessionValue("ProcessInvoice|Window_ID");
+    vars.removeSessionValue("ProcessInvoice|Tab_ID");
+    vars.removeSessionValue("ProcessInvoice|Org_ID");
   }
 
   void printPageDocAction(HttpServletResponse response, VariablesSecureApp vars,
@@ -327,6 +431,100 @@
 
   }
 
+  void printPageCreditPaymentGrid(HttpServletResponse response, VariablesSecureApp vars,
+      String strC_Invoice_ID, String strdocaction, String strProcessing, String strdocstatus,
+      String stradTableId, String strWindowId, String strTabId, Date invoiceDate, String strOrg)
+      throws IOException, ServletException {
+    log4j.debug("Output: Credit Payment Grid popup");
+    String[] discard = { "" };
+    response.setContentType("text/html; charset=UTF-8");
+    PrintWriter out = response.getWriter();
+    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+        "org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid", discard).createXmlDocument();
+    xmlDocument.setParameter("css", vars.getTheme());
+    xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
+    xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\n");
+    xmlDocument.setParameter("cancel", Utility.messageBD(this, "Cancel", vars.getLanguage()));
+    xmlDocument.setParameter("ok", Utility.messageBD(this, "OK", vars.getLanguage()));
+    xmlDocument.setParameter("window", strWindowId);
+    xmlDocument.setParameter("tab", strTabId);
+    xmlDocument.setParameter("adOrgId", strOrg);
+
+    xmlDocument.setParameter("invoiceGrossAmt", dao.getObject(Invoice.class, strC_Invoice_ID)
+        .getGrandTotalAmount().toString());
+
+    OBError myMessage = vars.getMessage("ProcessInvoice|CreditPaymentGrid");
+    vars.removeMessage("ProcessInvoice|CreditPaymentGrid");
+    if (myMessage != null) {
+      xmlDocument.setParameter("messageType", myMessage.getType());
+      xmlDocument.setParameter("messageTitle", myMessage.getTitle());
+      xmlDocument.setParameter("messageMessage", myMessage.getMessage());
+    }
+
+    xmlDocument.setParameter("dateDisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
+    xmlDocument.setParameter("paymentDate",
+        Utility.formatDate(invoiceDate, vars.getJavaDateFormat()));
+
+    out.println(xmlDocument.print());
+    out.close();
+
+  }
+
+  private void printGrid(HttpServletResponse response, VariablesSecureApp vars, String invoiceId)
+      throws IOException, ServletException {
+    log4j.debug("Output: Grid with credit payments");
+
+    final Invoice invoice = dao.getObject(Invoice.class, invoiceId);
+
+    String[] discard = {};
+    XmlDocument xmlDocument = xmlEngine.readXmlTemplate(
+        "org/openbravo/erpCommon/ad_actionButton/AddCreditPaymentGrid", discard)
+        .createXmlDocument();
+
+    xmlDocument.setData("structure", getCreditPayments(invoice));
+
+    response.setContentType("text/html; charset=UTF-8");
+    PrintWriter out = response.getWriter();
+    out.println(xmlDocument.print());
+    out.close();
+  }
+
+  private FieldProvider[] getCreditPayments(Invoice invoice) {
+    FieldProvider[] data = FieldProviderFactory.getFieldProviderArray(creditPayments);
+    String dateFormat = OBPropertiesProvider.getInstance().getOpenbravoProperties()
+        .getProperty("dateFormat.java");
+    SimpleDateFormat dateFormater = new SimpleDateFormat(dateFormat);
+
+    BigDecimal pendingToPay = invoice.getGrandTotalAmount();
+    for (int i = 0; i < data.length; i++) {
+      FieldProviderFactory.setField(data[i], "finCreditPaymentId", creditPayments.get(i).getId());
+      FieldProviderFactory.setField(data[i], "documentNo", creditPayments.get(i).getDocumentNo());
+      FieldProviderFactory.setField(data[i], "paymentDescription", creditPayments.get(i)
+          .getDescription());
+      if (creditPayments.get(i).getPaymentDate() != null) {
+        FieldProviderFactory.setField(data[i], "documentDate",
+            dateFormater.format(creditPayments.get(i).getPaymentDate()).toString());
+      }
+
+      final BigDecimal outStandingAmt = creditPayments.get(i).getGeneratedCredit()
+          .subtract(creditPayments.get(i).getUsedCredit());
+      FieldProviderFactory.setField(data[i], "outstandingAmount", outStandingAmt.toString());
+
+      FieldProviderFactory.setField(
+          data[i],
+          "paymentAmount",
+          pendingToPay.compareTo(outStandingAmt) > 0 ? outStandingAmt.toString() : (pendingToPay
+              .compareTo(BigDecimal.ZERO) > 0 ? pendingToPay.toString() : ""));
+      pendingToPay = pendingToPay.subtract(outStandingAmt);
+
+      FieldProviderFactory.setField(data[i], "finSelectedCreditPaymentId",
+          "".equals(data[i].getField("paymentAmount")) ? "" : creditPayments.get(i).getId());
+      FieldProviderFactory.setField(data[i], "rownum", String.valueOf(i));
+    }
+
+    return data;
+  }
+
   private boolean isInvoiceWithPayments(Invoice invoice) {
     for (FIN_PaymentSchedule ps : OBDao.getFilteredCriteria(FIN_PaymentSchedule.class,
         Restrictions.eq(FIN_PaymentSchedule.PROPERTY_INVOICE, invoice)).list()) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Mon Nov 07 14:22:37 2011 +0100
@@ -1421,6 +1421,7 @@
     obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_RECEIPT, isReceipt));
     obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_GENERATEDCREDIT, BigDecimal.ZERO));
     obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_STATUS, "RPAP"));
+    obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_STATUS, "RPVOID"));
     obcPayment.add(Restrictions.neProperty(FIN_Payment.PROPERTY_GENERATEDCREDIT,
         FIN_Payment.PROPERTY_USEDCREDIT));
     obcPayment.addOrderBy(FIN_Payment.PROPERTY_PAYMENTDATE, true);
@@ -1428,6 +1429,38 @@
     return obcPayment.list();
   }
 
+  /**
+   * Returns the list of credit payments for the selected business partner that belongs to the legal
+   * entity's natural tree of the given organization
+   * 
+   * @param org
+   * @param bp
+   * @param isReceipt
+   * @return
+   */
+  public List<FIN_Payment> getCustomerPaymentsWithCredit(Organization org, BusinessPartner bp,
+      boolean isReceipt) {
+    try {
+      OBContext.setAdminMode(true);
+      OBCriteria<FIN_Payment> obcPayment = OBDal.getInstance().createCriteria(FIN_Payment.class);
+      obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_BUSINESSPARTNER, bp));
+      obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_RECEIPT, isReceipt));
+      obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_GENERATEDCREDIT, BigDecimal.ZERO));
+      obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_STATUS, "RPAP"));
+      obcPayment.add(Restrictions.ne(FIN_Payment.PROPERTY_STATUS, "RPVOID"));
+      obcPayment.add(Restrictions.neProperty(FIN_Payment.PROPERTY_GENERATEDCREDIT,
+          FIN_Payment.PROPERTY_USEDCREDIT));
+      final Organization legalEntity = FIN_Utility.getLegalEntityOrg(org);
+      obcPayment.add(Restrictions.in("organization.id", OBContext.getOBContext()
+          .getOrganizationStructureProvider().getNaturalTree(legalEntity.getId())));
+      obcPayment.addOrderBy(FIN_Payment.PROPERTY_PAYMENTDATE, true);
+      obcPayment.addOrderBy(FIN_Payment.PROPERTY_DOCUMENTNO, true);
+      return obcPayment.list();
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+
   public List<FIN_Payment> getCustomerPaymentsWithUsedCredit(BusinessPartner bp, Boolean isReceipt) {
     OBCriteria<FIN_Payment> obcPayment = OBDal.getInstance().createCriteria(FIN_Payment.class);
     obcPayment.add(Restrictions.eq(FIN_Payment.PROPERTY_BUSINESSPARTNER, bp));
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_AddPayment.java	Mon Nov 07 14:22:37 2011 +0100
@@ -37,6 +37,7 @@
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.base.session.OBPropertiesProvider;
+import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
@@ -473,15 +474,30 @@
   public static HashMap<String, BigDecimal> getSelectedPaymentDetailsAndAmount(
       VariablesSecureApp vars, List<FIN_PaymentScheduleDetail> selectedPaymentScheduleDetails)
       throws ServletException {
-    HashMap<String, BigDecimal> selectedPaymentScheduleDetailsAmounts = new HashMap<String, BigDecimal>();
+    return getSelectedBaseOBObjectAmount(vars, selectedPaymentScheduleDetails, "inpPaymentAmount");
+  }
 
-    for (FIN_PaymentScheduleDetail paymentScheduleDetail : selectedPaymentScheduleDetails) {
-      selectedPaymentScheduleDetailsAmounts.put(
-          paymentScheduleDetail.getId(),
-          new BigDecimal(vars.getNumericParameter(
-              "inpPaymentAmount" + paymentScheduleDetail.getId(), "")));
+  /**
+   * Creates a HashMap with the BaseOBObject id's and the amount gotten from the Session.
+   * 
+   * The amounts are stored in Session like "htmlElementId"+basobObject.Id
+   * 
+   * @param vars
+   *          VariablseSecureApp with the session data.
+   * @param selectedPaymentScheduleDetails
+   *          List of FIN_PaymentScheduleDetails that need to be included in the HashMap.
+   * @return A HashMap mapping the FIN_PaymentScheduleDetail's Id with the corresponding amount.
+   */
+  public static <T extends BaseOBObject> HashMap<String, BigDecimal> getSelectedBaseOBObjectAmount(
+      VariablesSecureApp vars, List<T> selectedBaseOBObjects, String htmlElementId)
+      throws ServletException {
+    HashMap<String, BigDecimal> selectedBaseOBObjectAmounts = new HashMap<String, BigDecimal>();
+
+    for (final T o : selectedBaseOBObjects) {
+      selectedBaseOBObjectAmounts.put((String) o.getId(),
+          new BigDecimal(vars.getNumericParameter(htmlElementId + (String) o.getId(), "")));
     }
-    return selectedPaymentScheduleDetailsAmounts;
+    return selectedBaseOBObjectAmounts;
   }
 
   /**
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Mon Nov 07 14:22:37 2011 +0100
@@ -21,6 +21,7 @@
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -45,8 +46,10 @@
 import org.openbravo.model.financialmgmt.payment.FIN_Payment;
 import org.openbravo.model.financialmgmt.payment.FIN_PaymentDetail;
 import org.openbravo.model.financialmgmt.payment.FIN_PaymentScheduleDetail;
+import org.openbravo.model.financialmgmt.payment.FIN_Payment_Credit;
 import org.openbravo.model.financialmgmt.payment.PaymentExecutionProcess;
 import org.openbravo.scheduling.ProcessBundle;
+import org.openbravo.service.db.DalConnectionProvider;
 
 public class FIN_PaymentProcess implements org.openbravo.scheduling.Process {
   private static AdvPaymentMngtDao dao;
@@ -180,8 +183,7 @@
           if (paymentAmount.compareTo(payment.getAmount()) != 0)
             payment.setUsedCredit(paymentAmount.subtract(payment.getAmount()));
           if (payment.getUsedCredit().compareTo(BigDecimal.ZERO) != 0)
-            updateUsedCredit(payment.getUsedCredit(), payment.getBusinessPartner(),
-                payment.isReceipt());
+            updateUsedCredit(payment);
 
           payment.setWriteoffAmount(paymentWriteOfAmount);
           payment.setProcessed(true);
@@ -372,23 +374,46 @@
           }
           List<FIN_PaymentDetail> paymentDetails = payment.getFINPaymentDetailList();
           List<ConversionRateDoc> conversionRates = payment.getCurrencyConversionRateDocList();
+          Set<String> invoiceDocNos = new HashSet<String>();
           for (FIN_PaymentDetail paymentDetail : paymentDetails) {
             removedPDS = new ArrayList<FIN_PaymentScheduleDetail>();
             for (FIN_PaymentScheduleDetail paymentScheduleDetail : paymentDetail
                 .getFINPaymentScheduleDetailList()) {
               BigDecimal amount = paymentScheduleDetail.getAmount().add(
                   paymentScheduleDetail.getWriteoffAmount());
-              if (paymentScheduleDetail.getInvoicePaymentSchedule() != null && restorePaidAmounts) {
-                FIN_AddPayment.updatePaymentScheduleAmounts(paymentScheduleDetail
-                    .getInvoicePaymentSchedule(), paymentScheduleDetail.getAmount().negate(),
-                    paymentScheduleDetail.getWriteoffAmount().negate());
-                // BP SO_CreditUsed
-                businessPartner = paymentScheduleDetail.getInvoicePaymentSchedule().getInvoice()
-                    .getBusinessPartner();
-                if (isReceipt) {
-                  increaseCustomerCredit(businessPartner, amount);
-                } else {
-                  decreaseCustomerCredit(businessPartner, amount);
+              if (paymentScheduleDetail.getInvoicePaymentSchedule() != null) {
+                // Remove invoice description related to the credit payments
+                final Invoice invoice = paymentScheduleDetail.getInvoicePaymentSchedule()
+                    .getInvoice();
+                invoiceDocNos.add(invoice.getDocumentNo());
+                final String invDesc = invoice.getDescription();
+                if (invDesc != null) {
+                  final String creditMsg = Utility.messageBD(new DalConnectionProvider(),
+                      "APRM_InvoiceDescUsedCredit", vars.getLanguage());
+                  if (creditMsg != null) {
+                    final StringBuffer newDesc = new StringBuffer();
+                    for (final String line : invDesc.split("\n")) {
+                      if (!line.startsWith(creditMsg.substring(0, creditMsg.lastIndexOf("%s")))) {
+                        newDesc.append(line);
+                        if (!"".equals(line))
+                          newDesc.append("\n");
+                      }
+                    }
+                    invoice.setDescription(newDesc.toString());
+                  }
+                }
+                if (restorePaidAmounts) {
+                  FIN_AddPayment.updatePaymentScheduleAmounts(paymentScheduleDetail
+                      .getInvoicePaymentSchedule(), paymentScheduleDetail.getAmount().negate(),
+                      paymentScheduleDetail.getWriteoffAmount().negate());
+                  // BP SO_CreditUsed
+                  businessPartner = paymentScheduleDetail.getInvoicePaymentSchedule().getInvoice()
+                      .getBusinessPartner();
+                  if (isReceipt) {
+                    increaseCustomerCredit(businessPartner, amount);
+                  } else {
+                    decreaseCustomerCredit(businessPartner, amount);
+                  }
                 }
               }
               if (paymentScheduleDetail.getOrderPaymentSchedule() != null && restorePaidAmounts) {
@@ -428,9 +453,43 @@
 
           if (payment.getGeneratedCredit().compareTo(BigDecimal.ZERO) == 0
               && payment.getUsedCredit().compareTo(BigDecimal.ZERO) == 1) {
-            undoUsedCredit(payment.getUsedCredit(), payment.getBusinessPartner(),
-                payment.isReceipt());
+            undoUsedCredit(payment, vars, invoiceDocNos);
           }
+
+          List<FIN_Payment> creditPayments = new ArrayList<FIN_Payment>();
+          for (final FIN_Payment_Credit pc : payment.getFINPaymentCreditList()) {
+            creditPayments.add(pc.getCreditPaymentUsed());
+          }
+          for (final FIN_Payment creditPayment : creditPayments) {
+            // Update Description
+            final String payDesc = creditPayment.getDescription();
+            if (payDesc != null) {
+              final String invoiceDocNoMsg = Utility.messageBD(new DalConnectionProvider(),
+                  "APRM_CreditUsedinInvoice", vars.getLanguage());
+              if (invoiceDocNoMsg != null) {
+                final StringBuffer newDesc = new StringBuffer();
+                for (final String line : payDesc.split("\n")) {
+                  boolean include = true;
+                  if (line.startsWith(invoiceDocNoMsg.substring(0,
+                      invoiceDocNoMsg.lastIndexOf("%s")))) {
+                    for (final String docNo : invoiceDocNos) {
+                      if (line.indexOf(docNo) > 0) {
+                        include = false;
+                        break;
+                      }
+                    }
+                  }
+                  if (include) {
+                    newDesc.append(line);
+                    if (!"".equals(line))
+                      newDesc.append("\n");
+                  }
+                }
+                creditPayment.setDescription(newDesc.toString());
+              }
+            }
+          }
+          payment.getFINPaymentCreditList().clear();
           payment.setGeneratedCredit(BigDecimal.ZERO);
           payment.setUsedCredit(BigDecimal.ZERO);
 
@@ -491,6 +550,7 @@
              * Cancel all payment schedule details related to the payment
              */
             final List<FIN_PaymentScheduleDetail> removedPDS = new ArrayList<FIN_PaymentScheduleDetail>();
+            Set<String> invoiceDocNos = new HashSet<String>();
             for (final FIN_PaymentDetail paymentDetail : payment.getFINPaymentDetailList()) {
               for (final FIN_PaymentScheduleDetail paymentScheduleDetail : paymentDetail
                   .getFINPaymentScheduleDetailList()) {
@@ -508,6 +568,8 @@
                       outStandingAmt = outStandingAmt.add(invScheDetail.getAmount());
                       paymentScheduleDetail.setCanceled(true);
                     }
+                    invoiceDocNos.add(paymentScheduleDetail.getInvoicePaymentSchedule()
+                        .getInvoice().getDocumentNo());
                   }
                   // Create merged Payment Schedule Detail with the pending to be paid amount
                   if (outStandingAmt.compareTo(BigDecimal.ZERO) != 0) {
@@ -555,6 +617,12 @@
               for (FIN_PaymentScheduleDetail removedPD : removedPDS)
                 OBDal.getInstance().remove(removedPD);
             }
+            if (payment.getGeneratedCredit().compareTo(BigDecimal.ZERO) == 0
+                && payment.getUsedCredit().compareTo(BigDecimal.ZERO) == 1) {
+              undoUsedCredit(payment, vars, invoiceDocNos);
+            }
+            payment.getFINPaymentCreditList().clear();
+            payment.setUsedCredit(BigDecimal.ZERO);
           }
         } finally {
           OBDal.getInstance().flush();
@@ -630,36 +698,80 @@
     return true;
   }
 
-  private static void updateUsedCredit(BigDecimal usedAmount, BusinessPartner bp, boolean isReceipt) {
-    List<FIN_Payment> payments = dao.getCustomerPaymentsWithCredit(bp, isReceipt);
-    BigDecimal pendingToAllocateAmount = usedAmount;
-    for (FIN_Payment payment : payments) {
-      BigDecimal availableAmount = payment.getGeneratedCredit().subtract(payment.getUsedCredit());
-      if (pendingToAllocateAmount.compareTo(availableAmount) == 1) {
-        payment.setUsedCredit(payment.getUsedCredit().add(availableAmount));
-        pendingToAllocateAmount = pendingToAllocateAmount.subtract(availableAmount);
-        OBDal.getInstance().save(payment);
-      } else {
-        payment.setUsedCredit(payment.getUsedCredit().add(pendingToAllocateAmount));
-        OBDal.getInstance().save(payment);
-        break;
+  private void updateUsedCredit(FIN_Payment newPayment) {
+    if (newPayment.getFINPaymentCreditList().isEmpty()) {
+      // We process the payment from the Payment In/Out window (not from the Process Invoice flow)
+      final BigDecimal usedAmount = newPayment.getUsedCredit();
+      final BusinessPartner bp = newPayment.getBusinessPartner();
+      final boolean isReceipt = newPayment.isReceipt();
+
+      List<FIN_Payment> creditPayments = dao.getCustomerPaymentsWithCredit(bp, isReceipt);
+      BigDecimal pendingToAllocateAmount = usedAmount;
+      for (FIN_Payment creditPayment : creditPayments) {
+        BigDecimal availableAmount = creditPayment.getGeneratedCredit().subtract(
+            creditPayment.getUsedCredit());
+        if (pendingToAllocateAmount.compareTo(availableAmount) == 1) {
+          creditPayment.setUsedCredit(creditPayment.getUsedCredit().add(availableAmount));
+          pendingToAllocateAmount = pendingToAllocateAmount.subtract(availableAmount);
+          linkCreditPayment(newPayment, availableAmount, creditPayment);
+          OBDal.getInstance().save(creditPayment);
+        } else {
+          creditPayment.setUsedCredit(creditPayment.getUsedCredit().add(pendingToAllocateAmount));
+          linkCreditPayment(newPayment, pendingToAllocateAmount, creditPayment);
+          OBDal.getInstance().save(creditPayment);
+          break;
+        }
       }
     }
   }
 
-  private void undoUsedCredit(BigDecimal usedAmount, BusinessPartner bp, Boolean isReceipt) {
-    List<FIN_Payment> payments = dao.getCustomerPaymentsWithUsedCredit(bp, isReceipt);
-    BigDecimal pendingDeallocateAmount = usedAmount;
-    for (FIN_Payment payment : payments) {
-      BigDecimal paymentUsedAmount = payment.getUsedCredit();
-      if (usedAmount.compareTo(paymentUsedAmount) == 1) {
-        payment.setUsedCredit(BigDecimal.ZERO);
-        pendingDeallocateAmount = pendingDeallocateAmount.subtract(paymentUsedAmount);
-        OBDal.getInstance().save(payment);
-      } else {
-        payment.setUsedCredit(payment.getUsedCredit().subtract(pendingDeallocateAmount));
-        OBDal.getInstance().save(payment);
-        break;
+  public static void linkCreditPayment(FIN_Payment newPayment, BigDecimal usedAmount,
+      FIN_Payment creditPayment) {
+    final FIN_Payment_Credit creditInfo = OBProvider.getInstance().get(FIN_Payment_Credit.class);
+    creditInfo.setPayment(newPayment);
+    creditInfo.setAmount(usedAmount);
+    creditInfo.setCurrency(newPayment.getCurrency());
+    creditInfo.setCreditPaymentUsed(creditPayment);
+    creditInfo.setOrganization(newPayment.getOrganization());
+    creditInfo.setClient(newPayment.getClient());
+    newPayment.getFINPaymentCreditList().add(creditInfo);
+  }
+
+  private void undoUsedCredit(FIN_Payment myPayment, VariablesSecureApp vars,
+      Set<String> invoiceDocNos) {
+    final List<FIN_Payment> payments = new ArrayList<FIN_Payment>();
+    for (final FIN_Payment_Credit pc : myPayment.getFINPaymentCreditList()) {
+      final FIN_Payment creditPaymentUsed = pc.getCreditPaymentUsed();
+      creditPaymentUsed.setUsedCredit(creditPaymentUsed.getUsedCredit().subtract(pc.getAmount()));
+      payments.add(creditPaymentUsed);
+    }
+
+    for (final FIN_Payment payment : payments) {
+      // Update Description
+      final String payDesc = payment.getDescription();
+      if (payDesc != null) {
+        final String invoiceDocNoMsg = Utility.messageBD(new DalConnectionProvider(),
+            "APRM_CreditUsedinInvoice", vars.getLanguage());
+        if (invoiceDocNoMsg != null) {
+          final StringBuffer newDesc = new StringBuffer();
+          for (final String line : payDesc.split("\n")) {
+            boolean include = true;
+            if (line.startsWith(invoiceDocNoMsg.substring(0, invoiceDocNoMsg.lastIndexOf("%s")))) {
+              for (final String docNo : invoiceDocNos) {
+                if (line.indexOf(docNo) > 0) {
+                  include = false;
+                  break;
+                }
+              }
+            }
+            if (include) {
+              newDesc.append(line);
+              if (!"".equals(line))
+                newDesc.append("\n");
+            }
+          }
+          payment.setDescription(newDesc.toString());
+        }
       }
     }
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Mon Nov 07 14:22:37 2011 +0100
@@ -45,6 +45,7 @@
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.client.kernel.reference.UIDefinitionController;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.security.OrganizationStructureProvider;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.data.FieldProvider;
@@ -981,4 +982,28 @@
     return "Y".equals(result);
   }
 
+  /**
+   * Returns the legal entity of the given organization
+   * 
+   * @param org
+   *          organization to get its legal entity
+   * @return legal entity (with or without accounting) organization or null if not found
+   */
+  public static Organization getLegalEntityOrg(final Organization org) {
+    try {
+      OBContext.setAdminMode(true);
+      final OrganizationStructureProvider osp = OBContext.getOBContext()
+          .getOrganizationStructureProvider(org.getClient().getId());
+      for (final String orgId : osp.getParentList(org.getId(), true)) {
+        final Organization parentOrg = OBDal.getInstance().get(Organization.class, orgId);
+        if (parentOrg.getOrganizationType().isLegalEntity()) {
+          return parentOrg;
+        }
+      }
+      return null;
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+
 }
--- a/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -473,6 +473,17 @@
 <!--8B947CC936E44FBCBCE62F4E02A01C63-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
 <!--8B947CC936E44FBCBCE62F4E02A01C63--></AD_TEXTINTERFACES>
 
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A--><AD_TEXTINTERFACES>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <AD_TEXTINTERFACES_ID><![CDATA[8DFAF1EEAAE24EE094C0BF142C0BE56A]]></AD_TEXTINTERFACES_ID>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <TEXT><![CDATA[Payment Date]]></TEXT>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportExcel.jrxml]]></FILENAME>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--8DFAF1EEAAE24EE094C0BF142C0BE56A--></AD_TEXTINTERFACES>
+
 <!--937AA8C7B9DA4ACF92B9A1ACA7719A65--><AD_TEXTINTERFACES>
 <!--937AA8C7B9DA4ACF92B9A1ACA7719A65-->  <AD_TEXTINTERFACES_ID><![CDATA[937AA8C7B9DA4ACF92B9A1ACA7719A65]]></AD_TEXTINTERFACES_ID>
 <!--937AA8C7B9DA4ACF92B9A1ACA7719A65-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -594,6 +605,105 @@
 <!--AC44B03FF40047059E663CEB9CF49A5A-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
 <!--AC44B03FF40047059E663CEB9CF49A5A--></AD_TEXTINTERFACES>
 
+<!--AF049D5097F14A79E040007F010149FB--><AD_TEXTINTERFACES>
+<!--AF049D5097F14A79E040007F010149FB-->  <AD_TEXTINTERFACES_ID><![CDATA[AF049D5097F14A79E040007F010149FB]]></AD_TEXTINTERFACES_ID>
+<!--AF049D5097F14A79E040007F010149FB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AF049D5097F14A79E040007F010149FB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AF049D5097F14A79E040007F010149FB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AF049D5097F14A79E040007F010149FB-->  <TEXT><![CDATA[Include Payments Using Credit]]></TEXT>
+<!--AF049D5097F14A79E040007F010149FB-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.html]]></FILENAME>
+<!--AF049D5097F14A79E040007F010149FB-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AF049D5097F14A79E040007F010149FB-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AF049D5097F14A79E040007F010149FB--></AD_TEXTINTERFACES>
+
+<!--AF2D1591711675E8E040007F0101337D--><AD_TEXTINTERFACES>
+<!--AF2D1591711675E8E040007F0101337D-->  <AD_TEXTINTERFACES_ID><![CDATA[AF2D1591711675E8E040007F0101337D]]></AD_TEXTINTERFACES_ID>
+<!--AF2D1591711675E8E040007F0101337D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AF2D1591711675E8E040007F0101337D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AF2D1591711675E8E040007F0101337D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AF2D1591711675E8E040007F0101337D-->  <TEXT><![CDATA[Payment Description]]></TEXT>
+<!--AF2D1591711675E8E040007F0101337D-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportExcel.jrxml]]></FILENAME>
+<!--AF2D1591711675E8E040007F0101337D-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AF2D1591711675E8E040007F0101337D-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AF2D1591711675E8E040007F0101337D--></AD_TEXTINTERFACES>
+
+<!--AF2E12144150C776E040007F01013C23--><AD_TEXTINTERFACES>
+<!--AF2E12144150C776E040007F01013C23-->  <AD_TEXTINTERFACES_ID><![CDATA[AF2E12144150C776E040007F01013C23]]></AD_TEXTINTERFACES_ID>
+<!--AF2E12144150C776E040007F01013C23-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AF2E12144150C776E040007F01013C23-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AF2E12144150C776E040007F01013C23-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AF2E12144150C776E040007F01013C23-->  <TEXT><![CDATA[Include Payments Using Credit:]]></TEXT>
+<!--AF2E12144150C776E040007F01013C23-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportPDF.jrxml]]></FILENAME>
+<!--AF2E12144150C776E040007F01013C23-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AF2E12144150C776E040007F01013C23-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AF2E12144150C776E040007F01013C23--></AD_TEXTINTERFACES>
+
+<!--AFAA1DE81243FDE8E040007F010159B7--><AD_TEXTINTERFACES>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <AD_TEXTINTERFACES_ID><![CDATA[AFAA1DE81243FDE8E040007F010159B7]]></AD_TEXTINTERFACES_ID>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <TEXT><![CDATA[* Invoice paid using a credit payment]]></TEXT>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.html]]></FILENAME>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AFAA1DE81243FDE8E040007F010159B7-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AFAA1DE81243FDE8E040007F010159B7--></AD_TEXTINTERFACES>
+
+<!--AFB970D388478761E040007F01012C25--><AD_TEXTINTERFACES>
+<!--AFB970D388478761E040007F01012C25-->  <AD_TEXTINTERFACES_ID><![CDATA[AFB970D388478761E040007F01012C25]]></AD_TEXTINTERFACES_ID>
+<!--AFB970D388478761E040007F01012C25-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AFB970D388478761E040007F01012C25-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AFB970D388478761E040007F01012C25-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AFB970D388478761E040007F01012C25-->  <TEXT><![CDATA[** Several invoices have been paid using the same credit payment]]></TEXT>
+<!--AFB970D388478761E040007F01012C25-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.html]]></FILENAME>
+<!--AFB970D388478761E040007F01012C25-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AFB970D388478761E040007F01012C25-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AFB970D388478761E040007F01012C25--></AD_TEXTINTERFACES>
+
+<!--AFBBE094BB53D031E040007F01013B9F--><AD_TEXTINTERFACES>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <AD_TEXTINTERFACES_ID><![CDATA[AFBBE094BB53D031E040007F01013B9F]]></AD_TEXTINTERFACES_ID>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <TEXT><![CDATA[* Invoice paid using a credit payment]]></TEXT>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportExcel.jrxml]]></FILENAME>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AFBBE094BB53D031E040007F01013B9F-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AFBBE094BB53D031E040007F01013B9F--></AD_TEXTINTERFACES>
+
+<!--AFBBE094BB55D031E040007F01013B9F--><AD_TEXTINTERFACES>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <AD_TEXTINTERFACES_ID><![CDATA[AFBBE094BB55D031E040007F01013B9F]]></AD_TEXTINTERFACES_ID>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <TEXT><![CDATA[** Several invoices have been paid using the same credit payment]]></TEXT>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportExcel.jrxml]]></FILENAME>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AFBBE094BB55D031E040007F01013B9F-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AFBBE094BB55D031E040007F01013B9F--></AD_TEXTINTERFACES>
+
+<!--AFBBE094BB57D031E040007F01013B9F--><AD_TEXTINTERFACES>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <AD_TEXTINTERFACES_ID><![CDATA[AFBBE094BB57D031E040007F01013B9F]]></AD_TEXTINTERFACES_ID>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <TEXT><![CDATA[* Invoice paid using a credit payment]]></TEXT>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportPDF.jrxml]]></FILENAME>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AFBBE094BB57D031E040007F01013B9F-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AFBBE094BB57D031E040007F01013B9F--></AD_TEXTINTERFACES>
+
+<!--AFBBE094BB59D031E040007F01013B9F--><AD_TEXTINTERFACES>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <AD_TEXTINTERFACES_ID><![CDATA[AFBBE094BB59D031E040007F01013B9F]]></AD_TEXTINTERFACES_ID>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <TEXT><![CDATA[** Several invoices have been paid using the same credit payment]]></TEXT>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <FILENAME><![CDATA[/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportPDF.jrxml]]></FILENAME>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AFBBE094BB59D031E040007F01013B9F-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
+<!--AFBBE094BB59D031E040007F01013B9F--></AD_TEXTINTERFACES>
+
 <!--B682A4F7A92C45A4BE2D04E087F45B6D--><AD_TEXTINTERFACES>
 <!--B682A4F7A92C45A4BE2D04E087F45B6D-->  <AD_TEXTINTERFACES_ID><![CDATA[B682A4F7A92C45A4BE2D04E087F45B6D]]></AD_TEXTINTERFACES_ID>
 <!--B682A4F7A92C45A4BE2D04E087F45B6D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.html	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.html	Mon Nov 07 14:22:37 2011 +0100
@@ -13,7 +13,7 @@
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SL 
-* All portions are Copyright (C) 2009 Openbravo SL 
+* All portions are Copyright (C) 2009-2011 Openbravo SL 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -279,7 +279,7 @@
   <input type="hidden" name="inpSecondKey"></input>
   <input type="hidden" name="inpKeyReferenceId"></input>
   <input type="hidden" name="inpTableReferenceId"></input>
-  <input type="hidden" name="inpissotrx" id="IsSOTrx" value="N">
+  <input type="hidden" name="inpissotrx" id="IsSOTrx" value="N"></input>
   <input type="hidden" name="inpAdTableId"></input>
   <input type="hidden" name="inpIsReceipt"></input>
   <input type="hidden" name="inpRecordId"></input>
@@ -407,6 +407,13 @@
                                 </tbody>
                               </table>
                             <!-- USER CONTROLS -->
+						  </td>
+						</tr>
+					  </table>
+					
+					</td>
+				   </tr>
+				 </table>		
               <table class="Main_Client_TableEdition">
                 <tr>
                   <td class="TableEdition_OneCell_width"></td>
@@ -504,7 +511,7 @@
                         </td>
                         <td class="FieldButton_ContentCell">
                           <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Calendar'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="calculator('frmMain.inpAmountFrom', document.frmMain.inpAmountFrom.value);return false;">
-                            <table class="FieldButton"  onmouseout="window.status='';return true;" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calculator';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
+                            <table class="FieldButton"  onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calculator';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
                               <tr>
                                 <td class="FieldButton_bg">
                                   <img alt="Calendar" class="FieldButton_Icon FieldButton_Icon_Calc" title="Calendar" src="../../../../../web/images/blank.gif" border="0"></img>
@@ -527,7 +534,7 @@
                         </td>
                         <td class="FieldButton_ContentCell">
                           <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Calendar'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="calculator('frmMain.inpAmountTo', document.frmMain.inpAmountTo.value);return false;">
-                            <table class="FieldButton"  onmouseout="window.status='';return true;" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calculator';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
+                            <table class="FieldButton"  onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calculator';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
                               <tr>
                                 <td class="FieldButton_bg">
                                   <img alt="Calendar" class="FieldButton_Icon FieldButton_Icon_Calc" title="Calendar" src="../../../../../web/images/blank.gif" border="0"></img>
@@ -788,13 +795,13 @@
                     <select  name="inpPaymentMethodId" id="paramPaymentMethodId" class="Combo Combo_TwoCells_width">
                       <option value=""> <div id="reportPaymentMethod_ID"></div></option>
                     </select>
-                  </td>
-                  <td class="TitleCell"><span class="LabelText">Financial Account</span></td>
-                  <td class="Combo_ContentCell" colspan="2">
-                    <select  name="inpFinancialAccountId" id="paramFinancialAccountId" class="Combo Combo_TwoCells_width">
-                      <option value=""> <div id="reportFinancialAccount_ID"></div></option>
-                    </select>
-                  </td>
+                  </td>  
+                  <td class="ContentCell"></td>
+                  <td class="TitleCell"><span class="LabelText">Include Payments Using Credit</span></td>
+                  <td class="Radio_Check_ContentCell">
+                    <span class="Checkbox_container_NOT_Focused">
+                      <input type="checkbox" name="inpInclPaymentUsingCredit" value="Y" id="paramInclPaymentUsingCredit"></input>
+                    </span></td>
                 </tr>
                 <tr>
                   <td class="TitleCell"><span class="LabelText">Currency</span></td>
@@ -803,9 +810,12 @@
                       <option value=""> <div id="reportC_Currency_ID"></div></option>
                     </select>
                   </td>
-                  <td class="ContentCell"></td>
-                  <td class="ContentCell"></td>
-                  <td class="ContentCell"></td>
+                  <td class="TitleCell"><span class="LabelText">Financial Account</span></td>
+                  <td class="Combo_ContentCell" colspan="2">
+                    <select  name="inpFinancialAccountId" id="paramFinancialAccountId" class="Combo Combo_TwoCells_width">
+                      <option value=""> <div id="reportFinancialAccount_ID"></div></option>
+                    </select>
+                  </td>
                 </tr>
                 
                 
@@ -843,7 +853,7 @@
                   <td class="TitleCell"><span class="LabelText">Payment Type</span></td>
                   <td class="Combo_ContentCell" colspan="2">
                     <select  name="inpPaymType" id="paramPaymType" class="ComboKey Combo_TwoCells_width" required="true">
-                        <option value=""><div id="reportPaymType"></option>
+                        <option value=""><div id="reportPaymType"></div></option>
                     </select>
                   </td>
                   <td class="ContentCell"></td>
@@ -1039,7 +1049,6 @@
                   <td class="ContentCell"></td>
                   <td class="ContentCell"></td>
                 </tr>
-              </table>
               <table class="Main_Client_TableEdition">
                   <tr>
                     <td colspan="6">
@@ -1081,11 +1090,12 @@
                                 <a href="#" onclick="validate(); openInvoiceTab('yy', 'zz');" onmouseover="window.status='Payment Report';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldInvLink" style="xx">
                                   <span id="fieldInvoiceNumber">xx14500.34</span>
                                 </a>
+                                <span id="fieldInvoiceNumber_nolink" class="DataGrid_Body_Cell" style="xx">xx14500.34</span>
                               </td>
                                 
                               <td width="10%" id="fieldInvoiceDate" class="DataGrid_Body_Cell_Amount">xx14500.34</td>
                               <td width="10%" class="DataGrid_Body_Cell_Amount">
-                                <a href="#" onclick="validate(); openPaymentTab('yy', 'zz');" onmouseover="window.status='Payment Report';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldPaymLink" style="xx">
+                                <a href="#" onclick="validate(); openPaymentTab('yy', 'zz');" onmouseover="window.status='Payment Report';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldPaymLink" style="xx" title="xx">
                                   <span id="fieldPayment">xx14500.34</span>
                                 </a>
                               </td>
@@ -1167,10 +1177,11 @@
                                       <a href="#" onclick="validate(); openInvoiceTab('yy', 'zz');" onmouseover="window.status='Payment Report';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldInvLink2" style="xx">
                                         <span id="fieldInvoiceNumber2">xx14500.34</span>
                                       </a>
+                                      <span id="fieldInvoiceNumber2_nolink" class="DataGrid_Body_Cell" style="xx">xx14500.34</span>
                                     </td>
                                     <td width="10%" id="fieldInvoiceDate2" class="DataGrid_Body_Cell_Amount">xx14500.34</td>
                                     <td width="10%" class="DataGrid_Body_Cell_Amount">
-                                      <a href="#" onclick="validate(); openPaymentTab('yy', 'zz');" onmouseover="window.status='Payment Report';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldPaymLink2" style="xx">
+                                      <a href="#" onclick="validate(); openPaymentTab('yy', 'zz');" onmouseover="window.status='Payment Report';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldPaymLink2" style="xx" title="xx">
                                         <span id="fieldPayment2">xx14500.34</span>
                                       </a>
                                     </td>
@@ -1225,18 +1236,23 @@
                 </table>
 
                       <!-- USER CONTROLS -->
-                </td>
+                <table class="Main_Client_TableEdition">
+			      <tr>
+				   <td>					
+				    <div id="paramShowOneAsterisk" style="xx" class="RelationInfoContent">* Invoice paid using a credit payment</div>
+				    <div id="paramShowTwoAsterisk" style="xx" class="RelationInfoContent">** Several invoices have been paid using the same credit payment</div>
+				   </td>
+				  </tr>
+			  </table>		
               </tr>
               </table>
-              </td>
-            </tr>
-          </table>
-        </div>
+        
         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="Menu_ContentPane_Bottom" id="tdbottomSeparator">
           <tr>
-            <td class="Main_Bottom_bg"><img src="../../../../../web/images/blank.gif" border="0"></td>
+            <td class="Main_Bottom_bg"><img src="../../../../../web/images/blank.gif" border="0"/></td>
           </tr>
         </table>
+	</div>
       </td>
       <td valign="top">
         <table width="100%" border="0" cellspacing="0" cellpadding="0" class="Main_ContentPane_Right" id="tdrightSeparator">
--- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.java	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.java	Mon Nov 07 14:22:37 2011 +0100
@@ -112,11 +112,13 @@
       String strOrdCrit = vars.getInGlobalVariable("inpShown", "PaymentReport|OrdCrit", "",
           new ValueListFilter("Date", "APRM_FATS_BPARTNER", "Project", "INS_CURRENCY",
               "FINPR_BPartner_Category", ""));
+      final String strInclPaymentUsingCredit = vars.getGlobalVariable("inpInclPaymentUsingCredit",
+          "PaymentReport|IncludePaymentUsingCredit", "Y");
       printPageDataSheet(response, vars, strOrg, strInclSubOrg, strDueDateFrom, strDueDateTo,
           strAmountFrom, strAmountTo, strDocumentDateFrom, strDocumentDateTo, strcBPartnerIdIN,
           strcBPGroupIdIN, strcProjectIdIN, strfinPaymSt, strPaymentMethodId,
           strFinancialAccountId, strcCurrency, strConvertCurrency, strConversionDate, strPaymType,
-          strOverdue, strGroupCrit, strOrdCrit);
+          strOverdue, strGroupCrit, strOrdCrit, strInclPaymentUsingCredit);
     } else if (vars.commandIn("FIND")) {
       String strOrg = vars.getRequestGlobalVariable("inpOrg", "PaymentReport|Organization");
       String strInclSubOrg = vars.getRequestGlobalVariable("inpInclSubOrg",
@@ -166,11 +168,14 @@
       String strOrdCrit = vars.getRequestInGlobalVariable("inpShown", "PaymentReport|OrdCrit",
           new ValueListFilter("Date", "APRM_FATS_BPARTNER", "Project", "INS_CURRENCY",
               "FINPR_BPartner_Category", ""));
+      final String strInclPaymentUsingCredit = vars.getStringParameter("inpInclPaymentUsingCredit",
+          "N");
+      vars.setSessionValue("PaymentReport|IncludePaymentUsingCredit", strInclPaymentUsingCredit);
       printPageDataSheet(response, vars, strOrg, strInclSubOrg, strDueDateFrom, strDueDateTo,
           strAmountFrom, strAmountTo, strDocumentDateFrom, strDocumentDateTo, strcBPartnerIdIN,
           strcBPGroupIdIN, strcProjectIdIN, strfinPaymSt, strPaymentMethodId,
           strFinancialAccountId, strcCurrency, strConvertCurrency, strConversionDate, strPaymType,
-          strOverdue, strGroupCrit, strOrdCrit);
+          strOverdue, strGroupCrit, strOrdCrit, strInclPaymentUsingCredit);
     } else if (vars.commandIn("PDF", "XLS")) {
       String strOrg = vars.getRequestGlobalVariable("inpOrg", "PaymentReport|Organization");
       String strInclSubOrg = vars.getRequestGlobalVariable("inpInclSubOrg",
@@ -215,6 +220,9 @@
           new ValueListFilter("Date", "APRM_FATS_BPARTNER", "Project", "INS_CURRENCY",
               "FINPR_BPartner_Category", ""));
       String strOutput = "html";
+      final String strInclPaymentUsingCredit = vars.getStringParameter("inpInclPaymentUsingCredit",
+          "N");
+      vars.setSessionValue("PaymentReport|IncludePaymentUsingCredit", strInclPaymentUsingCredit);
       if (vars.commandIn("PDF"))
         strOutput = "pdf";
       else if (vars.commandIn("XLS"))
@@ -224,7 +232,7 @@
           strAmountFrom, strAmountTo, strDocumentDateFrom, strDocumentDateTo, strcBPartnerIdIN,
           strcBPGroupIdIN, strcProjectIdIN, strfinPaymSt, strPaymentMethodId,
           strFinancialAccountId, strcCurrency, strConvertCurrency, strConversionDate, strPaymType,
-          strOverdue, strOutput, strGroupCrit, strOrdCrit);
+          strOverdue, strOutput, strGroupCrit, strOrdCrit, strInclPaymentUsingCredit);
 
     } else if (vars.commandIn("LINK")) {
       String strTableId = vars.getRequiredStringParameter("inpAdTableId", IsIDFilter.instance);
@@ -254,7 +262,7 @@
       String strcProjectIdIN, String strfinPaymSt, String strPaymentMethodId,
       String strFinancialAccountId, String strcCurrency, String strConvertCurrency,
       String strConversionDate, String strPaymType, String strOverdue, String strGroupCrit,
-      String strOrdCrit) throws IOException, ServletException {
+      String strOrdCrit, String strInclPaymentUsingCredit) throws IOException, ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: dataSheet");
     XmlDocument xmlDocument = null;
@@ -269,7 +277,7 @@
           strAmountFrom, strAmountTo, strDocumentDateFrom, strDocumentDateTo, strcBPartnerIdIN,
           strcBPGroupIdIN, strcProjectIdIN, strfinPaymSt, strPaymentMethodId,
           strFinancialAccountId, strcCurrency, strConvertCurrency, strConversionDate, strPaymType,
-          strOverdue, strGroupCrit, strOrdCrit);
+          strOverdue, strGroupCrit, strOrdCrit, strInclPaymentUsingCredit);
 
       if (data.length == 0) {
 
@@ -510,6 +518,7 @@
     xmlDocument
         .setParameter("conversionDatedisplaySave", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("paymType", strPaymType);
+    xmlDocument.setParameter("inclPaymentUsingCredit", strInclPaymentUsingCredit);
 
     Vector<Object> vector = new Vector<Object>(0);
     SQLReturnObject sqlRO = new SQLReturnObject();
@@ -601,12 +610,30 @@
     xmlDocument.setData("reportOrdCrit", "liststructure", objectListData);
     xmlDocument.setData("reportShown", "liststructure", PaymentReportDao.getObjectList(strOrdCrit));
 
+    xmlDocument.setParameter("showOneAsterisk", showAsterisk(data, "*") ? "" : "Display:none");
+    xmlDocument.setParameter("showTwoAsterisk", showAsterisk(data, "**") ? "" : "Display:none");
+
     response.setContentType("text/html; charset=UTF-8");
     PrintWriter out = response.getWriter();
     out.println(xmlDocument.print());
     out.close();
   }
 
+  private boolean showAsterisk(FieldProvider[] data, String asterisk) {
+    if (asterisk == null || "".equals(asterisk) || data == null)
+      return false;
+    boolean showAsterisk = false;
+    for (final FieldProvider fp : data) {
+      if (fp.getField("INVOICE_NUMBER") != null && !"".equals(fp.getField("INVOICE_NUMBER"))
+          && fp.getField("INVOICE_NUMBER").length() >= asterisk.length()
+          && asterisk.equals(fp.getField("INVOICE_NUMBER").substring(0, asterisk.length()))) {
+        showAsterisk = true;
+        break;
+      }
+    }
+    return showAsterisk;
+  }
+
   private void printPage(HttpServletRequest request, HttpServletResponse response,
       VariablesSecureApp vars, String strOrg, String strInclSubOrg, String strDueDateFrom,
       String strDueDateTo, String strAmountFrom, String strAmountTo, String strDocumentDateFrom,
@@ -614,7 +641,8 @@
       String strcProjectIdIN, String strfinPaymSt, String strPaymentMethodId,
       String strFinancialAccountId, String strcCurrency, String strConvertCurrency,
       String strConversionDate, String strPaymType, String strOverdue, String strOutput,
-      String strGroupCrit, String strOrdCrit) throws IOException, ServletException {
+      String strGroupCrit, String strOrdCrit, String strInclPaymentUsingCredit) throws IOException,
+      ServletException {
 
     response.setContentType("text/html; charset=UTF-8");
 
@@ -623,7 +651,7 @@
         strDueDateTo, strAmountFrom, strAmountTo, strDocumentDateFrom, strDocumentDateTo,
         strcBPartnerIdIN, strcBPGroupIdIN, strcProjectIdIN, strfinPaymSt, strPaymentMethodId,
         strFinancialAccountId, strcCurrency, strConvertCurrency, strConversionDate, strPaymType,
-        strOverdue, strGroupCrit, strOrdCrit);
+        strOverdue, strGroupCrit, strOrdCrit, strInclPaymentUsingCredit);
 
     if (data.length == 1 && data[0] == null) {
 
@@ -793,6 +821,14 @@
       parameters.put("OVERDUE_SHOW", Utility.messageBD(this, "No", vars.getLanguage()));
     parameters.put("GROUPCRIT_SHOW", Utility.messageBD(this, strGroupCrit, vars.getLanguage()));
     parameters.put("ORDCRIT_SHOW", strOrdCritShow);
+    if ("Y".equals(strInclPaymentUsingCredit)) {
+      parameters.put("INCL_PAYMENTUSINGCREDIT", Utility.messageBD(this, "Yes", vars.getLanguage()));
+    } else {
+      parameters.put("INCL_PAYMENTUSINGCREDIT", Utility.messageBD(this, "No", vars.getLanguage()));
+    }
+
+    parameters.put("ONE_ASTERISK_SHOW", new Boolean(showAsterisk(data, "*")));
+    parameters.put("TWO_ASTERISK_SHOW", new Boolean(showAsterisk(data, "**")));
 
     renderJR(vars, response, strReportName, strOutput, parameters, data, null);
   }
--- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReport.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -50,6 +50,9 @@
   <PARAMETER id="paramDocumentDateTo" name="documentDateTo" attribute="value"/>
   <PARAMETER id="paramDocumentDateTo" name="documentDateTodisplaySave" attribute="displayformat" replace="xx"/>
   <PARAMETER id="paramDocumentDateTo" name="documentDateTodisplaySave" attribute="saveformat" replace="yy"/>
+
+  <PARAMETER id="parameterInclPaymentUsingCredit" name="pinclPaymentUsingCredit" default="Y"/>
+  <PARAMETER id="paramInclPaymentUsingCredit" name="inclPaymentUsingCredit" boolean="checked" withId="parameterInclPaymentUsingCredit" default="Y"/>
   
   <PARAMETER id="paramcBPartnerId_INselected" name="paramcBPartnerId_INselected" default=""/>
   <SUBREPORT id="paramcBPartnerId_IN" name="paramcBPartnerId_IN" report="org/openbravo/erpCommon/reference/List">
@@ -124,6 +127,8 @@
     <FIELD id="fieldInvLink" attribute="onclick" replace="yy">ISRECEIPT</FIELD>
     <FIELD id="fieldInvLink" attribute="style" replace="xx">PAYMENT_PLAN_Y_N</FIELD>
     <FIELD id="fieldInvoiceNumber">INVOICE_NUMBER</FIELD>
+    <FIELD id="fieldInvoiceNumber_nolink">INVOICE_NUMBER</FIELD>
+    <FIELD id="fieldInvoiceNumber_nolink" attribute="style" replace="xx">NOT_PAYMENT_PLAN_Y_N</FIELD>
     
     <FIELD id="fieldInvoiceDate">INVOICE_DATE</FIELD>
     
@@ -131,6 +136,7 @@
     <FIELD id="fieldPaymLink" attribute="onclick" replace="zz">PAYMENT_ID</FIELD>
     <FIELD id="fieldPaymLink" attribute="onclick" replace="yy">ISRECEIPT</FIELD>
     <FIELD id="fieldPaymLink" attribute="style" replace="xx">PAYMENT_Y_N</FIELD>
+    <FIELD id="fieldPaymLink" attribute="title" replace="xx">PAYMENT_DESC</FIELD>
     
     <FIELD id="fieldDueDate">DUE_DATE</FIELD>
     <FIELD id="fieldPlannedDSO">PLANNED_DSO</FIELD>
@@ -163,12 +169,15 @@
     <FIELD id="fieldInvLink2" attribute="onclick" replace="yy">ISRECEIPT</FIELD>
     <FIELD id="fieldInvLink2" attribute="style" replace="xx">PAYMENT_PLAN_Y_N</FIELD>
     <FIELD id="fieldInvoiceNumber2">INVOICE_NUMBER</FIELD>
+    <FIELD id="fieldInvoiceNumber2_nolink">INVOICE_NUMBER</FIELD>
+    <FIELD id="fieldInvoiceNumber2_nolink" attribute="style" replace="xx">NOT_PAYMENT_PLAN_Y_N</FIELD>
     
     <FIELD id="fieldInvoiceDate2">INVOICE_DATE</FIELD>
     
     <FIELD id="fieldPaymLink2" attribute="onclick" replace="zz">PAYMENT_ID</FIELD>
     <FIELD id="fieldPaymLink2" attribute="onclick" replace="yy">ISRECEIPT</FIELD>
     <FIELD id="fieldPaymLink2" attribute="style" replace="xx">PAYMENT_Y_N</FIELD>
+    <FIELD id="fieldPaymLink2" attribute="title" replace="xx">PAYMENT_DESC</FIELD>
     <FIELD id="fieldPayment2">PAYMENT</FIELD>
     
     <FIELD id="fieldDueDate2">DUE_DATE</FIELD>
@@ -196,6 +205,9 @@
     <SECTION id="sectionStatus2" field="STATUS"/>
     <SECTION id="sectionDetail2"/>
   </structure>
-  
+
+   
+  <PARAMETER id="paramShowOneAsterisk" name="showOneAsterisk" attribute="style" replace="xx"/>
+  <PARAMETER id="paramShowTwoAsterisk" name="showTwoAsterisk" attribute="style" replace="xx"/>  
   <DISCARD id="discard"/>
 </REPORT>
--- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java	Mon Nov 07 14:22:37 2011 +0100
@@ -22,12 +22,15 @@
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.Vector;
 
+import org.hibernate.Query;
+import org.hibernate.Session;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.advpaymentmngt.utility.FIN_Utility;
 import org.openbravo.base.secureApp.VariablesSecureApp;
@@ -62,6 +65,8 @@
 
 public class PaymentReportDao {
 
+  private static final long milisecDayConv = (1000 * 60 * 60 * 24);
+
   public PaymentReportDao() {
   }
 
@@ -76,6 +81,20 @@
       String strPaymentMethodId, String strFinancialAccountId, String strcCurrency,
       String strConvertCurrency, String strConversionDate, String strPaymType, String strOverdue,
       String strGroupCrit, String strOrdCrit) {
+    return getPaymentReport(vars, strOrg, strInclSubOrg, strDueDateFrom, strDueDateTo,
+        strAmountFrom, strAmountTo, strDocumentDateFrom, strDocumentDateTo, strcBPartnerIdIN,
+        strcBPGroupIdIN, strcProjectIdIN, strfinPaymSt, strPaymentMethodId, strFinancialAccountId,
+        strcCurrency, strConvertCurrency, strConversionDate, strPaymType, strOverdue, strGroupCrit,
+        strOrdCrit, "Y");
+  }
+
+  public FieldProvider[] getPaymentReport(VariablesSecureApp vars, String strOrg,
+      String strInclSubOrg, String strDueDateFrom, String strDueDateTo, String strAmountFrom,
+      String strAmountTo, String strDocumentDateFrom, String strDocumentDateTo,
+      String strcBPartnerIdIN, String strcBPGroupIdIN, String strcProjectIdIN, String strfinPaymSt,
+      String strPaymentMethodId, String strFinancialAccountId, String strcCurrency,
+      String strConvertCurrency, String strConversionDate, String strPaymType, String strOverdue,
+      String strGroupCrit, String strOrdCrit, String strInclPaymentUsingCredit) {
 
     final StringBuilder hsqlScript = new StringBuilder();
     final java.util.List<Object> parameters = new ArrayList<Object>();
@@ -84,10 +103,6 @@
         .getProperty("dateFormat.java");
     SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatString);
     FieldProvider[] data;
-    Date invoicedDate;
-    long plannedDSO = 0;
-    long currentDSO = 0;
-    long currentTime = 0;
     Currency transCurrency;
     BigDecimal transAmount = null;
     ConversionRate convRate = null;
@@ -139,6 +154,12 @@
         }
       }
 
+      // Exclude payments that use credit payment
+      if (!strInclPaymentUsingCredit.equalsIgnoreCase("Y")) {
+        hsqlScript.append(" and not (pay.amount = 0 ");
+        hsqlScript.append(" and pay.usedCredit > pay.generatedCredit) ");
+      }
+
       // due date from - due date to
       if (!strDueDateFrom.isEmpty()) {
         hsqlScript.append(" and invps.");
@@ -381,7 +402,6 @@
       BigDecimal amountSum = BigDecimal.ZERO;
       FieldProvider previousRow = null;
       ConversionRate previousConvRate = null;
-      long milisecDayConv = (1000 * 60 * 60 * 24);
       boolean isReceipt = false;
       boolean isAmtInLimit = false;
 
@@ -408,11 +428,29 @@
               .getPaymentDetails().getFinPayment().getPaymentMethod().getIdentifier());
 
           // payment
-          FieldProviderFactory.setField(data[i], "PAYMENT", FIN_PaymentScheduleDetail[i]
-              .getPaymentDetails().getFinPayment().getIdentifier().toString());
+          FieldProviderFactory.setField(
+              data[i],
+              "PAYMENT",
+              dateFormat.format(FIN_PaymentScheduleDetail[i].getPaymentDetails().getFinPayment()
+                  .getPaymentDate())
+                  + " - "
+                  + FIN_PaymentScheduleDetail[i].getPaymentDetails().getFinPayment()
+                      .getDocumentNo());
+          // payment description
+          FieldProviderFactory.setField(data[i], "PAYMENT_DESC", FIN_PaymentScheduleDetail[i]
+              .getPaymentDetails().getFinPayment().getDescription());
           // payment_id
           FieldProviderFactory.setField(data[i], "PAYMENT_ID", FIN_PaymentScheduleDetail[i]
               .getPaymentDetails().getFinPayment().getId().toString());
+          // payment_date
+          FieldProviderFactory.setField(
+              data[i],
+              "PAYMENT_DATE",
+              dateFormat.format(FIN_PaymentScheduleDetail[i].getPaymentDetails().getFinPayment()
+                  .getPaymentDate()));
+          // payment_docNo
+          FieldProviderFactory.setField(data[i], "PAYMENT_DOCNO", FIN_PaymentScheduleDetail[i]
+              .getPaymentDetails().getFinPayment().getDocumentNo());
           // payment yes / no
           FieldProviderFactory.setField(data[i], "PAYMENT_Y_N", "");
           // financialAccount
@@ -449,6 +487,10 @@
           FieldProviderFactory.setField(data[i], "PAYMENT", "");
           // payment_id
           FieldProviderFactory.setField(data[i], "PAYMENT_ID", "");
+          // payment_date
+          FieldProviderFactory.setField(data[i], "PAYMENT_DATE", "");
+          // payment_docNo
+          FieldProviderFactory.setField(data[i], "PAYMENT_DOCNO", "");
           // payment yes / no
           FieldProviderFactory.setField(data[i], "PAYMENT_Y_N", "Display:None");
           // financialAccount
@@ -469,59 +511,42 @@
         }
 
         if (FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule() != null) {
-          // project
-          if (FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule().getInvoice().getProject() != null)
-            FieldProviderFactory.setField(data[i], "PROJECT", FIN_PaymentScheduleDetail[i]
-                .getInvoicePaymentSchedule().getInvoice().getProject().getIdentifier());
-          else
+          fillLine(dateFormat, data[i], FIN_PaymentScheduleDetail[i],
+              FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule(), false);
+        } else if (FIN_PaymentScheduleDetail[i].getPaymentDetails().getFinPayment() != null) {
+          java.util.List<Invoice> invoices = getInvoicesUsingCredit(FIN_PaymentScheduleDetail[i]
+              .getPaymentDetails().getFinPayment());
+          if (invoices.size() == 1) {
+            FIN_PaymentSchedule ps = getInvoicePaymentSchedule(FIN_PaymentScheduleDetail[i]
+                .getPaymentDetails().getFinPayment());
+            fillLine(dateFormat, data[i], FIN_PaymentScheduleDetail[i], ps, true);
+          } else {
+            // project
             FieldProviderFactory.setField(data[i], "PROJECT", "");
-          // salesPerson
-          if (FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule().getInvoice()
-              .getSalesRepresentative() != null) {
-            FieldProviderFactory.setField(data[i], "SALES_PERSON", FIN_PaymentScheduleDetail[i]
-                .getInvoicePaymentSchedule().getInvoice().getSalesRepresentative().getIdentifier());
-          } else {
+            // salesPerson
             FieldProviderFactory.setField(data[i], "SALES_PERSON", "");
+            // invoiceNumber.
+            FieldProviderFactory.setField(data[i], "INVOICE_NUMBER", invoices.size() > 1 ? "**"
+                + getInvoicesDocNos(invoices) : "");
+            // payment plan id
+            FieldProviderFactory.setField(data[i], "PAYMENT_PLAN_ID", "");
+            // payment plan yes / no
+            FieldProviderFactory.setField(data[i], "PAYMENT_PLAN_Y_N",
+                invoices.size() != 1 ? "Display:none" : "");
+            // payment plan yes / no
+            FieldProviderFactory.setField(data[i], "NOT_PAYMENT_PLAN_Y_N", invoices.size() > 1 ? ""
+                : "Display:none");
+            // invoiceDate
+            FieldProviderFactory.setField(data[i], "INVOICE_DATE", "");
+            // dueDate.
+            FieldProviderFactory.setField(data[i], "DUE_DATE", "");
+            // plannedDSO
+            FieldProviderFactory.setField(data[i], "PLANNED_DSO", "0");
+            // currentDSO
+            FieldProviderFactory.setField(data[i], "CURRENT_DSO", "0");
+            // daysOverdue
+            FieldProviderFactory.setField(data[i], "OVERDUE", "0");
           }
-          // invoiceNumber
-          FieldProviderFactory.setField(data[i], "INVOICE_NUMBER", FIN_PaymentScheduleDetail[i]
-              .getInvoicePaymentSchedule().getInvoice().getDocumentNo());
-          // payment plan id
-          FieldProviderFactory.setField(data[i], "PAYMENT_PLAN_ID", FIN_PaymentScheduleDetail[i]
-              .getInvoicePaymentSchedule().getId());
-          // payment plan yes / no
-          FieldProviderFactory.setField(data[i], "PAYMENT_PLAN_Y_N", "");
-          // invoiceDate
-          invoicedDate = FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule().getInvoice()
-              .getInvoiceDate();
-          FieldProviderFactory.setField(data[i], "INVOICE_DATE", dateFormat.format(invoicedDate)
-              .toString());
-          // dueDate
-          FieldProviderFactory
-              .setField(
-                  data[i],
-                  "DUE_DATE",
-                  dateFormat.format(
-                      FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule().getDueDate())
-                      .toString());
-          // plannedDSO
-          plannedDSO = (FIN_PaymentScheduleDetail[i].getInvoicePaymentSchedule().getDueDate()
-              .getTime() - invoicedDate.getTime())
-              / milisecDayConv;
-          FieldProviderFactory.setField(data[i], "PLANNED_DSO", String.valueOf(plannedDSO));
-          // currentDSO
-          if (FIN_PaymentScheduleDetail[i].getPaymentDetails() != null) {
-            currentDSO = (FIN_PaymentScheduleDetail[i].getPaymentDetails().getFinPayment()
-                .getPaymentDate().getTime() - invoicedDate.getTime())
-                / milisecDayConv;
-          } else {
-            currentTime = System.currentTimeMillis();
-            currentDSO = (currentTime - invoicedDate.getTime()) / milisecDayConv;
-          }
-          FieldProviderFactory.setField(data[i], "CURRENT_DSO", String.valueOf((currentDSO)));
-          // daysOverdue
-          FieldProviderFactory.setField(data[i], "OVERDUE",
-              String.valueOf((currentDSO - plannedDSO)));
         } else {
           // project
           FieldProviderFactory.setField(data[i], "PROJECT", "");
@@ -533,6 +558,8 @@
           FieldProviderFactory.setField(data[i], "PAYMENT_PLAN_ID", "");
           // payment plan yes / no
           FieldProviderFactory.setField(data[i], "PAYMENT_PLAN_Y_N", "Display:none");
+          // payment plan yes / no
+          FieldProviderFactory.setField(data[i], "NOT_PAYMENT_PLAN_Y_N", "Display:none");
           // invoiceDate
           FieldProviderFactory.setField(data[i], "INVOICE_DATE", "");
           // dueDate.
@@ -558,15 +585,22 @@
           convRate = this.getConversionRate(transCurrency, baseCurrency, strConversionDate);
 
           if (convRate != null) {
+            final int stdPrecission = convRate.getToCurrency().getStandardPrecision().intValue();
             if (isReceipt) {
               FieldProviderFactory.setField(data[i], "TRANS_AMOUNT", transAmount.toString());
-              FieldProviderFactory.setField(data[i], "BASE_AMOUNT",
-                  transAmount.multiply(convRate.getMultipleRateBy()).toString());
+              FieldProviderFactory.setField(
+                  data[i],
+                  "BASE_AMOUNT",
+                  transAmount.multiply(convRate.getMultipleRateBy())
+                      .setScale(stdPrecission, BigDecimal.ROUND_HALF_UP).toString());
             } else {
               FieldProviderFactory.setField(data[i], "TRANS_AMOUNT", transAmount.negate()
                   .toString());
-              FieldProviderFactory.setField(data[i], "BASE_AMOUNT",
-                  transAmount.multiply(convRate.getMultipleRateBy()).negate().toString());
+              FieldProviderFactory.setField(
+                  data[i],
+                  "BASE_AMOUNT",
+                  transAmount.multiply(convRate.getMultipleRateBy())
+                      .setScale(stdPrecission, BigDecimal.ROUND_HALF_UP).negate().toString());
             }
           } else {
             FieldProvider[] fp = new FieldProvider[1];
@@ -642,12 +676,20 @@
                 FieldProviderFactory.setField(previousRow, "BASE_AMOUNT", amountSum.negate()
                     .toString());
             } else {
+              final int stdPrecission = previousConvRate.getToCurrency().getStandardPrecision()
+                  .intValue();
               if (previousRow.getField("ISRECEIPT").equalsIgnoreCase("Y"))
-                FieldProviderFactory.setField(previousRow, "BASE_AMOUNT",
-                    amountSum.multiply(previousConvRate.getMultipleRateBy()).toString());
+                FieldProviderFactory.setField(
+                    previousRow,
+                    "BASE_AMOUNT",
+                    amountSum.multiply(previousConvRate.getMultipleRateBy())
+                        .setScale(stdPrecission, BigDecimal.ROUND_HALF_UP).toString());
               else
-                FieldProviderFactory.setField(previousRow, "BASE_AMOUNT",
-                    amountSum.multiply(previousConvRate.getMultipleRateBy()).negate().toString());
+                FieldProviderFactory.setField(
+                    previousRow,
+                    "BASE_AMOUNT",
+                    amountSum.multiply(previousConvRate.getMultipleRateBy())
+                        .setScale(stdPrecission, BigDecimal.ROUND_HALF_UP).negate().toString());
             }
 
             if (strAmountFrom.isEmpty() && strAmountTo.isEmpty()) {
@@ -710,12 +752,20 @@
             FieldProviderFactory
                 .setField(previousRow, "BASE_AMOUNT", amountSum.negate().toString());
         } else {
+          final int stdPrecission = previousConvRate.getToCurrency().getStandardPrecision()
+              .intValue();
           if (previousRow.getField("ISRECEIPT").equalsIgnoreCase("Y"))
-            FieldProviderFactory.setField(previousRow, "BASE_AMOUNT",
-                amountSum.multiply(previousConvRate.getMultipleRateBy()).toString());
+            FieldProviderFactory.setField(
+                previousRow,
+                "BASE_AMOUNT",
+                amountSum.multiply(previousConvRate.getMultipleRateBy())
+                    .setScale(stdPrecission, BigDecimal.ROUND_HALF_UP).toString());
           else
-            FieldProviderFactory.setField(previousRow, "BASE_AMOUNT",
-                amountSum.multiply(previousConvRate.getMultipleRateBy()).negate().toString());
+            FieldProviderFactory.setField(
+                previousRow,
+                "BASE_AMOUNT",
+                amountSum.multiply(previousConvRate.getMultipleRateBy())
+                    .setScale(stdPrecission, BigDecimal.ROUND_HALF_UP).negate().toString());
         }
 
         if (strAmountFrom.isEmpty() && strAmountTo.isEmpty()) {
@@ -743,6 +793,58 @@
     return (FieldProvider[]) groupedData.toArray(new FieldProvider[groupedData.size()]);
   }
 
+  private void fillLine(SimpleDateFormat dateFormat, FieldProvider data,
+      FIN_PaymentScheduleDetail fIN_PaymentScheduleDetail, FIN_PaymentSchedule paymentSchedule,
+      boolean creditPaysInvoice) {
+    Date invoicedDate;
+    long plannedDSO = 0;
+    long currentDSO = 0;
+    long currentTime = 0;
+    // project
+    if (paymentSchedule.getInvoice().getProject() != null)
+      FieldProviderFactory.setField(data, "PROJECT", paymentSchedule.getInvoice().getProject()
+          .getIdentifier());
+    else
+      FieldProviderFactory.setField(data, "PROJECT", "");
+    // salesPerson
+    if (paymentSchedule.getInvoice().getSalesRepresentative() != null) {
+      FieldProviderFactory.setField(data, "SALES_PERSON", paymentSchedule.getInvoice()
+          .getSalesRepresentative().getIdentifier());
+    } else {
+      FieldProviderFactory.setField(data, "SALES_PERSON", "");
+    }
+    // invoiceNumber
+    FieldProviderFactory.setField(data, "INVOICE_NUMBER", (creditPaysInvoice ? "*" : "")
+        + paymentSchedule.getInvoice().getDocumentNo());
+    // payment plan id
+    FieldProviderFactory.setField(data, "PAYMENT_PLAN_ID", paymentSchedule.getId());
+    // payment plan yes / no
+    FieldProviderFactory.setField(data, "PAYMENT_PLAN_Y_N", "");
+    // payment plan yes / no
+    FieldProviderFactory.setField(data, "NOT_PAYMENT_PLAN_Y_N", "Display:none");
+    // invoiceDate
+    invoicedDate = paymentSchedule.getInvoice().getInvoiceDate();
+    FieldProviderFactory.setField(data, "INVOICE_DATE", dateFormat.format(invoicedDate).toString());
+    // dueDate
+    FieldProviderFactory.setField(data, "DUE_DATE", dateFormat.format(paymentSchedule.getDueDate())
+        .toString());
+    // plannedDSO
+    plannedDSO = (paymentSchedule.getDueDate().getTime() - invoicedDate.getTime()) / milisecDayConv;
+    FieldProviderFactory.setField(data, "PLANNED_DSO", String.valueOf(plannedDSO));
+    // currentDSO
+    if (fIN_PaymentScheduleDetail.getPaymentDetails() != null) {
+      currentDSO = (fIN_PaymentScheduleDetail.getPaymentDetails().getFinPayment().getPaymentDate()
+          .getTime() - invoicedDate.getTime())
+          / milisecDayConv;
+    } else {
+      currentTime = System.currentTimeMillis();
+      currentDSO = (currentTime - invoicedDate.getTime()) / milisecDayConv;
+    }
+    FieldProviderFactory.setField(data, "CURRENT_DSO", String.valueOf((currentDSO)));
+    // daysOverdue
+    FieldProviderFactory.setField(data, "OVERDUE", String.valueOf((currentDSO - plannedDSO)));
+  }
+
   public ConversionRate getConversionRate(Currency transCurrency, Currency baseCurrency,
       String conversionDate) {
 
@@ -900,6 +1002,60 @@
     }
   }
 
+  public java.util.List<Invoice> getInvoicesUsingCredit(final FIN_Payment payment) {
+    final StringBuilder sql = new StringBuilder();
+    final java.util.List<Invoice> result = new ArrayList<Invoice>();
+
+    sql.append(" select distinct(pdv.invoicePaymentPlan.invoice.id) ");
+    sql.append(" from FIN_Payment_Credit pc, FIN_Payment p0, ");
+    sql.append("      FIN_Payment p1, FIN_Payment_Detail_V pdv  ");
+    sql.append(" where p0.id=pc.creditPaymentUsed ");
+    sql.append(" and pc.payment=p1.id ");
+    sql.append(" and pdv.payment=p1.id ");
+    sql.append(" and p0.id = '" + payment.getId() + "' ");
+
+    try {
+      OBContext.setAdminMode(true);
+      final Session session = OBDal.getInstance().getSession();
+      final Query query = session.createQuery(sql.toString());
+      for (final Object o : query.list()) {
+        result.add(OBDal.getInstance().get(Invoice.class, (String) o));
+      }
+
+      return result;
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+
+  public FIN_PaymentSchedule getInvoicePaymentSchedule(FIN_Payment credit_payment) {
+    final StringBuilder sql = new StringBuilder();
+    sql.append(" select ps ");
+    sql.append(" from FIN_Payment_Credit pc, FIN_Payment_Detail_V pdv, ");
+    sql.append(" FIN_Payment_Schedule ps ");
+    sql.append(" where pc.payment = pdv.payment ");
+    sql.append(" and ps.id = pdv.invoicePaymentPlan ");
+    sql.append(" and pc.creditPaymentUsed.id = '" + credit_payment.getId() + "' ");
+
+    try {
+      OBContext.setAdminMode(true);
+      final Session session = OBDal.getInstance().getSession();
+      final Query query = session.createQuery(sql.toString());
+      return (FIN_PaymentSchedule) query.uniqueResult();
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+
+  public String getInvoicesDocNos(Collection<Invoice> invoices) {
+    final StringBuilder sb = new StringBuilder();
+    for (Invoice i : invoices) {
+      sb.append(i.getDocumentNo());
+      sb.append(", ");
+    }
+    return sb.delete(sb.length() - 2, sb.length()).toString();
+  }
+
   private BusinessPartner getDocumentBusinessPartner(FIN_PaymentScheduleDetail psd) {
     BusinessPartner bp = null;
     if (psd.getInvoicePaymentSchedule() != null) { // Invoice
--- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportExcel.jrxml	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportExcel.jrxml	Mon Nov 07 14:22:37 2011 +0100
@@ -6,9 +6,9 @@
 		 columnCount="1"
 		 printOrder="Vertical"
 		 orientation="Landscape"
-		 pageWidth="1062"
+		 pageWidth="1385"
 		 pageHeight="595"
-		 columnWidth="1002"
+		 columnWidth="1325"
 		 columnSpacing="0"
 		 leftMargin="30"
 		 rightMargin="30"
@@ -194,6 +194,12 @@
 	<parameter name="OVERDUE_SHOW" isForPrompting="false" class="java.lang.String"/>
 	<parameter name="GROUPCRIT_SHOW" isForPrompting="false" class="java.lang.String"/>
 	<parameter name="ORDCRIT_SHOW" isForPrompting="false" class="java.lang.String"/>
+	<parameter name="ONE_ASTERISK_SHOW" isForPrompting="false" class="java.lang.Boolean">
+		<defaultValueExpression ><![CDATA[new Boolean(false)]]></defaultValueExpression>
+	</parameter>
+	<parameter name="TWO_ASTERISK_SHOW" isForPrompting="false" class="java.lang.Boolean">
+		<defaultValueExpression ><![CDATA[new Boolean(false)]]></defaultValueExpression>
+	</parameter>
 	<queryString><![CDATA[SELECT 'hello' AS BP_GROUP, 'hello' AS BPARTNER, 'hello' AS PROJECT, 'hello' AS PAYMENT, 'hello' AS SALES_PERSON, 1234 AS INVOICE_NUMBER, to_Date('01/01/2010') AS INVOICE_DATE,
        to_Date('01/03/2010') AS DUE_DATE, 1234 AS PLANNED_DSO, 1234 AS CURRENT_DSO, 1234 AS OVERDUE, 1234 AS DAYS_OVERDUE, 1234 AS AMOUNT,
        'hello' AS CURRENCY, 1234 AS BASE_AMOUNT, 'hello' AS BASE_CURRENCY, 'hello' AS PAYMENT_METHOD, 'hello' AS FINANCIAL_ACCOUNT
@@ -219,6 +225,9 @@
 	<field name="FINANCIAL_ACCOUNT" class="java.lang.String"/>
 	<field name="GROUP_CRIT" class="java.lang.String"/>
 	<field name="STATUS" class="java.lang.String"/>
+	<field name="PAYMENT_DESC" class="java.lang.String"/>
+	<field name="PAYMENT_DATE" class="java.util.Date"/>
+	<field name="PAYMENT_DOCNO" class="java.lang.String"/>
 
 	<variable name="SUMSUBTOTALSTATUS" class="java.math.BigDecimal" resetType="Report" calculation="Sum">
 		<variableExpression><![CDATA[$F{BASE_AMOUNT}]]></variableExpression>
@@ -259,7 +268,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="507"
+						x="523"
 						y="25"
 						width="65"
 						height="25"
@@ -273,9 +282,9 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="327"
+						x="335"
 						y="25"
-						width="70"
+						width="78"
 						height="25"
 						key="staticText-5"/>
 					<box leftPadding="2"></box>
@@ -287,7 +296,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="397"
+						x="413"
 						y="25"
 						width="55"
 						height="25"
@@ -302,7 +311,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="452"
+						x="468"
 						y="25"
 						width="55"
 						height="25"
@@ -316,7 +325,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="572"
+						x="895"
 						y="25"
 						width="62"
 						height="25"
@@ -330,7 +339,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="634"
+						x="957"
 						y="25"
 						width="33"
 						height="25"
@@ -345,7 +354,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="667"
+						x="990"
 						y="25"
 						width="33"
 						height="25"
@@ -360,7 +369,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="700"
+						x="1023"
 						y="25"
 						width="36"
 						height="25"
@@ -374,7 +383,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="876"
+						x="1199"
 						y="25"
 						width="80"
 						height="25"
@@ -389,7 +398,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="956"
+						x="1279"
 						y="25"
 						width="46"
 						height="25"
@@ -404,7 +413,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="736"
+						x="1059"
 						y="25"
 						width="80"
 						height="25"
@@ -419,7 +428,7 @@
 				<staticText>
 					<reportElement
 						style="Detail_Header"
-						x="816"
+						x="1139"
 						y="25"
 						width="60"
 						height="25"
@@ -477,7 +486,7 @@
 						style="Detail_Header"
 						x="251"
 						y="25"
-						width="76"
+						width="84"
 						height="25"
 						key="staticText-20"/>
 					<box leftPadding="2"></box>
@@ -486,6 +495,34 @@
 					</textElement>
 				<text><![CDATA[Project]]></text>
 				</staticText>
+				<staticText>
+					<reportElement
+						style="Detail_Header"
+						x="588"
+						y="25"
+						width="227"
+						height="25"
+						key="staticText-22"/>
+					<box leftPadding="2"></box>
+					<textElement textAlignment="Left" verticalAlignment="Middle">
+						<font size="8" isBold="false"/>
+					</textElement>
+				<text><![CDATA[Payment Description]]></text>
+				</staticText>
+				<staticText>
+					<reportElement
+						style="Detail_Header"
+						x="815"
+						y="25"
+						width="80"
+						height="25"
+						key="staticText-25"/>
+					<box leftPadding="2"></box>
+					<textElement textAlignment="Left" verticalAlignment="Middle">
+						<font size="8" isBold="false"/>
+					</textElement>
+				<text><![CDATA[Payment Date]]></text>
+				</staticText>
 			</band>
 		</pageHeader>
 		<columnHeader>
@@ -511,7 +548,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="507"
+						x="523"
 						y="0"
 						width="65"
 						height="25"
@@ -520,14 +557,14 @@
 					<textElement>
 						<font size="8"/>
 					</textElement>
-				<textFieldExpression   class="java.lang.String"><![CDATA[($F{PAYMENT}==null ? " " : $F{PAYMENT})]]></textFieldExpression>
+				<textFieldExpression   class="java.lang.String"><![CDATA[$F{PAYMENT_DOCNO}]]></textFieldExpression>
 				</textField>
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="327"
+						x="335"
 						y="0"
-						width="70"
+						width="78"
 						height="25"
 						key="textField-5"/>
 					<box leftPadding="2"></box>
@@ -539,7 +576,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="397"
+						x="413"
 						y="0"
 						width="55"
 						height="25"
@@ -553,7 +590,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="452"
+						x="468"
 						y="0"
 						width="55"
 						height="25"
@@ -567,7 +604,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="572"
+						x="895"
 						y="0"
 						width="62"
 						height="25"
@@ -581,7 +618,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="634"
+						x="957"
 						y="0"
 						width="33"
 						height="25"
@@ -595,7 +632,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="667"
+						x="990"
 						y="0"
 						width="33"
 						height="25"
@@ -609,7 +646,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="700"
+						x="1023"
 						y="0"
 						width="36"
 						height="25"
@@ -623,7 +660,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="876"
+						x="1199"
 						y="0"
 						width="80"
 						height="25"
@@ -637,7 +674,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="956"
+						x="1279"
 						y="0"
 						width="46"
 						height="25"
@@ -651,7 +688,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="736"
+						x="1059"
 						y="0"
 						width="80"
 						height="25"
@@ -665,7 +702,7 @@
 				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
 					<reportElement
 						style="Report_Footer"
-						x="816"
+						x="1139"
 						y="0"
 						width="60"
 						height="25"
@@ -709,7 +746,7 @@
 						style="Report_Footer"
 						x="251"
 						y="0"
-						width="76"
+						width="84"
 						height="25"
 						key="textField-19"/>
 					<box leftPadding="2"></box>
@@ -718,6 +755,35 @@
 					</textElement>
 				<textFieldExpression   class="java.lang.String"><![CDATA[$F{PROJECT}]]></textFieldExpression>
 				</textField>
+				<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
+					<reportElement
+						style="Report_Footer"
+						x="588"
+						y="0"
+						width="227"
+						height="25"
+						key="textField-21"
+						stretchType="RelativeToBandHeight"/>
+					<box leftPadding="2"></box>
+					<textElement>
+						<font size="8"/>
+					</textElement>
+				<textFieldExpression   class="java.lang.String"><![CDATA[$F{PAYMENT_DESC}]]></textFieldExpression>
+				</textField>
+				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
+					<reportElement
+						style="Report_Footer"
+						x="815"
+						y="0"
+						width="80"
+						height="25"
+						key="textField-22"/>
+					<box leftPadding="2"></box>
+					<textElement>
+						<font size="8"/>
+					</textElement>
+				<textFieldExpression   class="java.util.Date"><![CDATA[$F{PAYMENT_DATE}]]></textFieldExpression>
+				</textField>
 			</band>
 		</detail>
 		<columnFooter>
@@ -728,6 +794,42 @@
 			<band height="0"  isSplitAllowed="true" >
 			</band>
 		</pageFooter>
+		<lastPageFooter>
+			<band height="40"  isSplitAllowed="true" >
+				<staticText>
+					<reportElement
+						style="Report_Footer"
+						x="1"
+						y="1"
+						width="693"
+						height="17"
+						key="staticText-23">
+							<printWhenExpression><![CDATA[$P{ONE_ASTERISK_SHOW}]]></printWhenExpression>
+						</reportElement>
+					<box></box>
+					<textElement>
+						<font size="8"/>
+					</textElement>
+				<text><![CDATA[* Invoice paid using a credit payment]]></text>
+				</staticText>
+				<staticText>
+					<reportElement
+						style="Report_Footer"
+						x="1"
+						y="18"
+						width="693"
+						height="17"
+						key="staticText-24">
+							<printWhenExpression><![CDATA[$P{TWO_ASTERISK_SHOW}]]></printWhenExpression>
+						</reportElement>
+					<box></box>
+					<textElement>
+						<font size="8"/>
+					</textElement>
+				<text><![CDATA[** Several invoices have been paid using the same credit payment]]></text>
+				</staticText>
+			</band>
+		</lastPageFooter>
 		<summary>
 			<band height="0"  isSplitAllowed="true" >
 			</band>
--- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportPDF.jrxml	Sun Nov 06 12:28:23 2011 +0100
+++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportPDF.jrxml	Mon Nov 07 14:22:37 2011 +0100
@@ -197,6 +197,13 @@
 	<parameter name="PAYMENT_METHOD_SHOW" isForPrompting="false" class="java.lang.String"/>
 	<parameter name="FINANCIAL_ACCOUNT_SHOW" isForPrompting="false" class="java.lang.String"/>
 	<parameter name="CONVERT_CURRENCY_SHOW" isForPrompting="false" class="java.lang.String"/>
+	<parameter name="INCL_PAYMENTUSINGCREDIT" isForPrompting="false" class="java.lang.String"/>
+	<parameter name="ONE_ASTERISK_SHOW" isForPrompting="false" class="java.lang.Boolean">
+		<defaultValueExpression ><![CDATA[new Boolean(false)]]></defaultValueExpression>
+	</parameter>
+	<parameter name="TWO_ASTERISK_SHOW" isForPrompting="false" class="java.lang.Boolean">
+		<defaultValueExpression ><![CDATA[new Boolean(false)]]></defaultValueExpression>
+	</parameter>
 	<queryString><![CDATA[SELECT 'hello' AS BP_GROUP, 'hello' AS BPARTNER, 'hello' AS PROJECT, 'hello' AS PAYMENT, 'hello' AS SALES_PERSON, 1234 AS INVOICE_NUMBER, to_Date('01/01/2010') AS INVOICE_DATE,
        to_Date('01/03/2010') AS DUE_DATE, 1234 AS PLANNED_DSO, 1234 AS CURRENT_DSO, 1234 AS OVERDUE, 1234 AS DAYS_OVERDUE, 1234 AS AMOUNT,
        'hello' AS CURRENCY, 1234 AS BASE_AMOUNT, 'hello' AS BASE_CURRENCY, 'hello' AS PAYMENT_METHOD, 'hello' AS FINANCIAL_ACCOUNT
@@ -385,6 +392,34 @@
 				<staticText>
 					<reportElement
 						style="Report_Footer"
+						x="408"
+						y="20"
+						width="179"
+						height="18"
+						key="staticText-50"/>
+					<box></box>
+					<textElement textAlignment="Right">
+						<font/>
+					</textElement>
+				<text><![CDATA[Include Payments Using Credit:]]></text>
+				</staticText>
+				<textField isStretchWithOverflow="false" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
+					<reportElement
+						style="Report_Footer"
+						x="593"
+						y="20"
+						width="179"
+						height="18"
+						key="textField-46"/>
+					<box></box>
+					<textElement>
+						<font/>
+					</textElement>
+				<textFieldExpression   class="java.lang.String"><![CDATA[$P{INCL_PAYMENTUSINGCREDIT}.toString()]]></textFieldExpression>
+				</textField>
+				<staticText>
+					<reportElement
+						style="Report_Footer"
 						x="11"
 						y="40"
 						width="179"
@@ -1865,6 +1900,42 @@
 			<band height="0"  isSplitAllowed="true" >
 			</band>
 		</pageFooter>
+		<lastPageFooter>
+			<band height="40"  isSplitAllowed="true" >
+				<staticText>
+					<reportElement
+						style="Report_Footer"
+						x="3"
+						y="4"
+						width="693"
+						height="17"
+						key="staticText-51">
+							<printWhenExpression><![CDATA[$P{ONE_ASTERISK_SHOW}]]></printWhenExpression>
+						</reportElement>
+					<box></box>
+					<textElement>
+						<font size="8"/>
+					</textElement>
+				<text><![CDATA[* Invoice paid using a credit payment]]></text>
+				</staticText>
+				<staticText>
+					<reportElement
+						style="Report_Footer"
+						x="3"
+						y="21"
+						width="693"
+						height="17"
+						key="staticText-52">
+							<printWhenExpression><![CDATA[$P{TWO_ASTERISK_SHOW}]]></printWhenExpression>
+						</reportElement>
+					<box></box>
+					<textElement>
+						<font size="8"/>
+					</textElement>
+				<text><![CDATA[** Several invoices have been paid using the same credit payment]]></text>
+				</staticText>
+			</band>
+		</lastPageFooter>
 		<summary>
 			<band height="30"  isSplitAllowed="true" >
 				<staticText>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/tables/FIN_PAYMENT_CREDIT.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,69 @@
+<?xml version="1.0"?>
+  <database name="TABLE FIN_PAYMENT_CREDIT">
+    <table name="FIN_PAYMENT_CREDIT" primaryKey="FIN_PAYMENT_CREDIT_KEY">
+      <column name="FIN_PAYMENT_CREDIT_ID" primaryKey="true" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="AD_CLIENT_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="AD_ORG_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="CREATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default><![CDATA[SYSDATE]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="CREATEDBY" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default><![CDATA[SYSDATE]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="UPDATEDBY" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="ISACTIVE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[Y]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="FIN_PAYMENT_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="FIN_PAYMENT_ID_USED" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="AMOUNT" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false">
+        <default><![CDATA[0]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="C_CURRENCY_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <foreign-key foreignTable="AD_CLIENT" name="FIN_CR_AD_CLIENT_PAYMENTS">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="FIN_CR_AD_ORG_PAYMENTS">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_CURRENCY" name="FIN_CR_C_CURRENCY_PAYMENTS">
+        <reference local="C_CURRENCY_ID" foreign="C_CURRENCY_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="FIN_PAYMENT" name="FIN_CR_FIN_PAYMENT">
+        <reference local="FIN_PAYMENT_ID" foreign="FIN_PAYMENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="FIN_PAYMENT" name="FIN_CR_FIN_PAYMENT_USED">
+        <reference local="FIN_PAYMENT_ID_USED" foreign="FIN_PAYMENT_ID"/>
+      </foreign-key>
+      <check name="FIN_CR_PAYMENT_ISACTIVE_CHK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+    </table>
+  </database>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -267000,6 +267000,421 @@
 <!--ACD6E6D9F125445C97E22C05EBA0A346-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
 <!--ACD6E6D9F125445C97E22C05EBA0A346--></AD_COLUMN>
 
+<!--ADFF06FF43CABA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CABA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <NAME><![CDATA[FIN_Payment_Credit_ID]]></NAME>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <DESCRIPTION><![CDATA[Unique identifier for a FIN Payment Credit]]></DESCRIPTION>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <HELP><![CDATA[Tracks the places where the credit payment has been used]]></HELP>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <COLUMNNAME><![CDATA[FIN_Payment_Credit_ID]]></COLUMNNAME>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[13]]></AD_REFERENCE_ID>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISKEY><![CDATA[Y]]></ISKEY>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[ADFF07B10A7856DCE040007F01012F40]]></AD_ELEMENT_ID>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <POSITION><![CDATA[1]]></POSITION>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43CABA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43CABA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43CBBA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CBBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <NAME><![CDATA[Client]]></NAME>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <COLUMNNAME><![CDATA[AD_Client_ID]]></COLUMNNAME>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <DEFAULTVALUE><![CDATA[@AD_CLIENT_ID@]]></DEFAULTVALUE>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[102]]></AD_ELEMENT_ID>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <POSITION><![CDATA[2]]></POSITION>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43CBBA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43CBBA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43CCBA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CCBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <NAME><![CDATA[Organization]]></NAME>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <COLUMNNAME><![CDATA[AD_Org_ID]]></COLUMNNAME>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <DEFAULTVALUE><![CDATA[@AD_ORG_ID@]]></DEFAULTVALUE>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[113]]></AD_ELEMENT_ID>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <POSITION><![CDATA[3]]></POSITION>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43CCBA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43CCBA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43CDBA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CDBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <NAME><![CDATA[Creation Date]]></NAME>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <DESCRIPTION><![CDATA[The date that this record is completed.]]></DESCRIPTION>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <HELP><![CDATA[The Created field indicates the date that this record was created.]]></HELP>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <COLUMNNAME><![CDATA[Created]]></COLUMNNAME>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <DEFAULTVALUE><![CDATA[SYSDATE]]></DEFAULTVALUE>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[245]]></AD_ELEMENT_ID>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <POSITION><![CDATA[4]]></POSITION>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43CDBA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43CDBA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43CEBA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CEBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <NAME><![CDATA[Created By]]></NAME>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <DESCRIPTION><![CDATA[User who created this records]]></DESCRIPTION>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <HELP><![CDATA[The Created By field indicates the user who created this record.]]></HELP>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <COLUMNNAME><![CDATA[Createdby]]></COLUMNNAME>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[246]]></AD_ELEMENT_ID>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <POSITION><![CDATA[5]]></POSITION>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43CEBA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43CEBA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43CFBA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CFBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <NAME><![CDATA[Updated]]></NAME>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <DESCRIPTION><![CDATA[x not implemented]]></DESCRIPTION>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <HELP><![CDATA[The Updated field indicates the date that this record was updated.]]></HELP>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <COLUMNNAME><![CDATA[Updated]]></COLUMNNAME>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <DEFAULTVALUE><![CDATA[SYSDATE]]></DEFAULTVALUE>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <SEQNO><![CDATA[60]]></SEQNO>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[607]]></AD_ELEMENT_ID>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <POSITION><![CDATA[6]]></POSITION>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43CFBA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43CFBA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43D0BA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D0BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <NAME><![CDATA[Updated By]]></NAME>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <DESCRIPTION><![CDATA[User who updated this records]]></DESCRIPTION>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <HELP><![CDATA[The Updated By field indicates the user who updated this record.]]></HELP>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <COLUMNNAME><![CDATA[Updatedby]]></COLUMNNAME>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <SEQNO><![CDATA[70]]></SEQNO>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[608]]></AD_ELEMENT_ID>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <POSITION><![CDATA[7]]></POSITION>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43D0BA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43D0BA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43D1BA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D1BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <NAME><![CDATA[Active]]></NAME>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <COLUMNNAME><![CDATA[Isactive]]></COLUMNNAME>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <DEFAULTVALUE><![CDATA[Y]]></DEFAULTVALUE>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[348]]></AD_ELEMENT_ID>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <POSITION><![CDATA[8]]></POSITION>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43D1BA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43D1BA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43D2BA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D2BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <NAME><![CDATA[Payment]]></NAME>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <DESCRIPTION><![CDATA[Payment event]]></DESCRIPTION>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <HELP><![CDATA[Payment event]]></HELP>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <COLUMNNAME><![CDATA[FIN_Payment_ID]]></COLUMNNAME>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISPARENT><![CDATA[Y]]></ISPARENT>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <SEQNO><![CDATA[90]]></SEQNO>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[7891269C83EA655DE040007F010155CE]]></AD_ELEMENT_ID>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <POSITION><![CDATA[9]]></POSITION>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43D2BA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43D2BA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43D4BA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D4BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <NAME><![CDATA[Amount]]></NAME>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <COLUMNNAME><![CDATA[Amount]]></COLUMNNAME>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[22]]></AD_REFERENCE_ID>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[12]]></FIELDLENGTH>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <DEFAULTVALUE><![CDATA[0]]></DEFAULTVALUE>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <SEQNO><![CDATA[110]]></SEQNO>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[7890366979712CEFE040007F01013334]]></AD_ELEMENT_ID>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <POSITION><![CDATA[12]]></POSITION>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43D4BA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43D4BA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFF06FF43D7BA83E040007F01012F39--><AD_COLUMN>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D7BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <NAME><![CDATA[Currency]]></NAME>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <DESCRIPTION><![CDATA[An accepted medium of monetary exchange that may vary across countries.]]></DESCRIPTION>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <HELP><![CDATA[Indicates the currency to be used when processing this document.]]></HELP>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <COLUMNNAME><![CDATA[C_Currency_ID]]></COLUMNNAME>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <SEQNO><![CDATA[140]]></SEQNO>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <AD_ELEMENT_ID><![CDATA[193]]></AD_ELEMENT_ID>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <POSITION><![CDATA[13]]></POSITION>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFF06FF43D7BA83E040007F01012F39-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFF06FF43D7BA83E040007F01012F39--></AD_COLUMN>
+
+<!--ADFFC3EEE6118D7AE040007F01013D8C--><AD_COLUMN>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_COLUMN_ID><![CDATA[ADFFC3EEE6118D7AE040007F01013D8C]]></AD_COLUMN_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <NAME><![CDATA[Credit Payment Used]]></NAME>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <DESCRIPTION><![CDATA[Represents the credit payment that has been used]]></DESCRIPTION>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <HELP><![CDATA[Represents the credit payment that has been used]]></HELP>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <COLUMNNAME><![CDATA[FIN_Payment_Id_Used]]></COLUMNNAME>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_REFERENCE_VALUE_ID><![CDATA[5E77652CBFEB4F03A3A0629642D024DD]]></AD_REFERENCE_VALUE_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <SEQNO><![CDATA[100]]></SEQNO>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_ELEMENT_ID><![CDATA[ADFFC3B26CB61D04E040007F01013D82]]></AD_ELEMENT_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <POSITION><![CDATA[10]]></POSITION>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--ADFFC3EEE6118D7AE040007F01013D8C-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--ADFFC3EEE6118D7AE040007F01013D8C--></AD_COLUMN>
+
 <!--AE3FB28F95334421BB3DFAAA5B85307A--><AD_COLUMN>
 <!--AE3FB28F95334421BB3DFAAA5B85307A-->  <AD_COLUMN_ID><![CDATA[AE3FB28F95334421BB3DFAAA5B85307A]]></AD_COLUMN_ID>
 <!--AE3FB28F95334421BB3DFAAA5B85307A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -25091,6 +25091,32 @@
 <!--AD9A07DFFE5541AF8B891693459BB6B5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--AD9A07DFFE5541AF8B891693459BB6B5--></AD_ELEMENT>
 
+<!--ADFF07B10A7856DCE040007F01012F40--><AD_ELEMENT>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <AD_ELEMENT_ID><![CDATA[ADFF07B10A7856DCE040007F01012F40]]></AD_ELEMENT_ID>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <COLUMNNAME><![CDATA[FIN_Payment_Credit_ID]]></COLUMNNAME>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <NAME><![CDATA[FIN Payment Credit]]></NAME>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <PRINTNAME><![CDATA[FIN Payment Credit]]></PRINTNAME>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <DESCRIPTION><![CDATA[Unique identifier for a FIN Payment Credit]]></DESCRIPTION>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <HELP><![CDATA[Tracks the places where the credit payment has been used]]></HELP>
+<!--ADFF07B10A7856DCE040007F01012F40-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF07B10A7856DCE040007F01012F40--></AD_ELEMENT>
+
+<!--ADFFC3B26CB61D04E040007F01013D82--><AD_ELEMENT>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <AD_ELEMENT_ID><![CDATA[ADFFC3B26CB61D04E040007F01013D82]]></AD_ELEMENT_ID>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <COLUMNNAME><![CDATA[FIN_Payment_Id_Used]]></COLUMNNAME>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <NAME><![CDATA[Credit Payment Used]]></NAME>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <PRINTNAME><![CDATA[Credit Payment Used]]></PRINTNAME>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <DESCRIPTION><![CDATA[Represents the credit payment that has been used]]></DESCRIPTION>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <HELP><![CDATA[Represents the credit payment that has been used]]></HELP>
+<!--ADFFC3B26CB61D04E040007F01013D82-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFFC3B26CB61D04E040007F01013D82--></AD_ELEMENT>
+
 <!--AF7A8ABE9B6711DDA4130016D4C601F7--><AD_ELEMENT>
 <!--AF7A8ABE9B6711DDA4130016D4C601F7-->  <AD_ELEMENT_ID><![CDATA[AF7A8ABE9B6711DDA4130016D4C601F7]]></AD_ELEMENT_ID>
 <!--AF7A8ABE9B6711DDA4130016D4C601F7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -190150,6 +190150,418 @@
 <!--AD44BF4F571E4D5BA903DE7AE04CCBBD-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--AD44BF4F571E4D5BA903DE7AE04CCBBD--></AD_FIELD>
 
+<!--ADFEA61356F9FF0CE040007F01013508--><AD_FIELD>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <AD_FIELD_ID><![CDATA[ADFEA61356F9FF0CE040007F01013508]]></AD_FIELD_ID>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <NAME><![CDATA[FIN_Payment_Credit_ID]]></NAME>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <DESCRIPTION><![CDATA[Unique identifier for a FIN Payment Credit]]></DESCRIPTION>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <HELP><![CDATA[Tracks the places where the credit payment has been used]]></HELP>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CABA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFEA61356F9FF0CE040007F01013508-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFEA61356F9FF0CE040007F01013508--></AD_FIELD>
+
+<!--ADFEA61356FBFF0CE040007F01013508--><AD_FIELD>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <AD_FIELD_ID><![CDATA[ADFEA61356FBFF0CE040007F01013508]]></AD_FIELD_ID>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <NAME><![CDATA[Client]]></NAME>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CBBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFEA61356FBFF0CE040007F01013508-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFEA61356FBFF0CE040007F01013508--></AD_FIELD>
+
+<!--ADFEA61356FDFF0CE040007F01013508--><AD_FIELD>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <AD_FIELD_ID><![CDATA[ADFEA61356FDFF0CE040007F01013508]]></AD_FIELD_ID>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <NAME><![CDATA[Organization]]></NAME>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CCBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFEA61356FDFF0CE040007F01013508-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFEA61356FDFF0CE040007F01013508--></AD_FIELD>
+
+<!--ADFEA61356FFFF0CE040007F01013508--><AD_FIELD>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <AD_FIELD_ID><![CDATA[ADFEA61356FFFF0CE040007F01013508]]></AD_FIELD_ID>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <NAME><![CDATA[Active]]></NAME>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D1BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFEA61356FFFF0CE040007F01013508-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFEA61356FFFF0CE040007F01013508--></AD_FIELD>
+
+<!--ADFEA6135701FF0CE040007F01013508--><AD_FIELD>
+<!--ADFEA6135701FF0CE040007F01013508-->  <AD_FIELD_ID><![CDATA[ADFEA6135701FF0CE040007F01013508]]></AD_FIELD_ID>
+<!--ADFEA6135701FF0CE040007F01013508-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFEA6135701FF0CE040007F01013508-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFEA6135701FF0CE040007F01013508-->  <NAME><![CDATA[Payment]]></NAME>
+<!--ADFEA6135701FF0CE040007F01013508-->  <DESCRIPTION><![CDATA[Payment event]]></DESCRIPTION>
+<!--ADFEA6135701FF0CE040007F01013508-->  <HELP><![CDATA[Payment event]]></HELP>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFEA6135701FF0CE040007F01013508-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFEA6135701FF0CE040007F01013508-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D2BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFEA6135701FF0CE040007F01013508-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFEA6135701FF0CE040007F01013508-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFEA6135701FF0CE040007F01013508-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFEA6135701FF0CE040007F01013508-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFEA6135701FF0CE040007F01013508-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFEA6135701FF0CE040007F01013508-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFEA6135701FF0CE040007F01013508-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFEA6135701FF0CE040007F01013508--></AD_FIELD>
+
+<!--ADFEA6135705FF0CE040007F01013508--><AD_FIELD>
+<!--ADFEA6135705FF0CE040007F01013508-->  <AD_FIELD_ID><![CDATA[ADFEA6135705FF0CE040007F01013508]]></AD_FIELD_ID>
+<!--ADFEA6135705FF0CE040007F01013508-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFEA6135705FF0CE040007F01013508-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFEA6135705FF0CE040007F01013508-->  <NAME><![CDATA[Amount]]></NAME>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFEA6135705FF0CE040007F01013508-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFEA6135705FF0CE040007F01013508-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D4BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--ADFEA6135705FF0CE040007F01013508-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFEA6135705FF0CE040007F01013508-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFEA6135705FF0CE040007F01013508-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFEA6135705FF0CE040007F01013508-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFEA6135705FF0CE040007F01013508-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFEA6135705FF0CE040007F01013508-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFEA6135705FF0CE040007F01013508-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFEA6135705FF0CE040007F01013508--></AD_FIELD>
+
+<!--ADFEA6135707FF0CE040007F01013508--><AD_FIELD>
+<!--ADFEA6135707FF0CE040007F01013508-->  <AD_FIELD_ID><![CDATA[ADFEA6135707FF0CE040007F01013508]]></AD_FIELD_ID>
+<!--ADFEA6135707FF0CE040007F01013508-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFEA6135707FF0CE040007F01013508-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFEA6135707FF0CE040007F01013508-->  <NAME><![CDATA[Currency]]></NAME>
+<!--ADFEA6135707FF0CE040007F01013508-->  <DESCRIPTION><![CDATA[An accepted medium of monetary exchange that may vary across countries.]]></DESCRIPTION>
+<!--ADFEA6135707FF0CE040007F01013508-->  <HELP><![CDATA[Indicates the currency to be used when processing this document.]]></HELP>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFEA6135707FF0CE040007F01013508-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFEA6135707FF0CE040007F01013508-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D7BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--ADFEA6135707FF0CE040007F01013508-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFEA6135707FF0CE040007F01013508-->  <SEQNO><![CDATA[60]]></SEQNO>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFEA6135707FF0CE040007F01013508-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFEA6135707FF0CE040007F01013508-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFEA6135707FF0CE040007F01013508-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFEA6135707FF0CE040007F01013508-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFEA6135707FF0CE040007F01013508-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFEA6135707FF0CE040007F01013508--></AD_FIELD>
+
+<!--ADFF308AA2DCA111E040007F0101304F--><AD_FIELD>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <AD_FIELD_ID><![CDATA[ADFF308AA2DCA111E040007F0101304F]]></AD_FIELD_ID>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <NAME><![CDATA[FIN Payment Credit]]></NAME>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <DESCRIPTION><![CDATA[Unique identifier for a FIN Payment Credit]]></DESCRIPTION>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <HELP><![CDATA[Tracks the places where the credit payment has been used]]></HELP>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CABA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFF308AA2DCA111E040007F0101304F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFF308AA2DCA111E040007F0101304F--></AD_FIELD>
+
+<!--ADFF308AA2DEA111E040007F0101304F--><AD_FIELD>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <AD_FIELD_ID><![CDATA[ADFF308AA2DEA111E040007F0101304F]]></AD_FIELD_ID>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <NAME><![CDATA[Client]]></NAME>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CBBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFF308AA2DEA111E040007F0101304F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFF308AA2DEA111E040007F0101304F--></AD_FIELD>
+
+<!--ADFF308AA2E0A111E040007F0101304F--><AD_FIELD>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <AD_FIELD_ID><![CDATA[ADFF308AA2E0A111E040007F0101304F]]></AD_FIELD_ID>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <NAME><![CDATA[Organization]]></NAME>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43CCBA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFF308AA2E0A111E040007F0101304F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFF308AA2E0A111E040007F0101304F--></AD_FIELD>
+
+<!--ADFF308AA2E2A111E040007F0101304F--><AD_FIELD>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <AD_FIELD_ID><![CDATA[ADFF308AA2E2A111E040007F0101304F]]></AD_FIELD_ID>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <NAME><![CDATA[Active]]></NAME>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D1BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFF308AA2E2A111E040007F0101304F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFF308AA2E2A111E040007F0101304F--></AD_FIELD>
+
+<!--ADFF308AA2E4A111E040007F0101304F--><AD_FIELD>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <AD_FIELD_ID><![CDATA[ADFF308AA2E4A111E040007F0101304F]]></AD_FIELD_ID>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <NAME><![CDATA[Payment]]></NAME>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <DESCRIPTION><![CDATA[Payment event]]></DESCRIPTION>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <HELP><![CDATA[Payment event]]></HELP>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D2BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFF308AA2E4A111E040007F0101304F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFF308AA2E4A111E040007F0101304F--></AD_FIELD>
+
+<!--ADFF308AA2E8A111E040007F0101304F--><AD_FIELD>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <AD_FIELD_ID><![CDATA[ADFF308AA2E8A111E040007F0101304F]]></AD_FIELD_ID>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <NAME><![CDATA[Amount]]></NAME>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D4BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFF308AA2E8A111E040007F0101304F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFF308AA2E8A111E040007F0101304F--></AD_FIELD>
+
+<!--ADFF308AA2ECA111E040007F0101304F--><AD_FIELD>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <AD_FIELD_ID><![CDATA[ADFF308AA2ECA111E040007F0101304F]]></AD_FIELD_ID>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <NAME><![CDATA[Currency]]></NAME>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <DESCRIPTION><![CDATA[An accepted medium of monetary exchange that may vary across countries.]]></DESCRIPTION>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <HELP><![CDATA[Indicates the currency to be used when processing this document.]]></HELP>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <AD_COLUMN_ID><![CDATA[ADFF06FF43D7BA83E040007F01012F39]]></AD_COLUMN_ID>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <SEQNO><![CDATA[60]]></SEQNO>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFF308AA2ECA111E040007F0101304F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFF308AA2ECA111E040007F0101304F--></AD_FIELD>
+
+<!--ADFFE9B884011DDDE040007F01013E19--><AD_FIELD>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <AD_FIELD_ID><![CDATA[ADFFE9B884011DDDE040007F01013E19]]></AD_FIELD_ID>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <NAME><![CDATA[Credit Payment Used]]></NAME>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <DESCRIPTION><![CDATA[Represents the credit payment that has been used]]></DESCRIPTION>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <HELP><![CDATA[Represents the credit payment that has been used]]></HELP>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <AD_COLUMN_ID><![CDATA[ADFFC3EEE6118D7AE040007F01013D8C]]></AD_COLUMN_ID>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFFE9B884011DDDE040007F01013E19-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFFE9B884011DDDE040007F01013E19--></AD_FIELD>
+
+<!--ADFFEB0194FF7FBCE040007F01013E25--><AD_FIELD>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <AD_FIELD_ID><![CDATA[ADFFEB0194FF7FBCE040007F01013E25]]></AD_FIELD_ID>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <NAME><![CDATA[Credit Payment Used]]></NAME>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <DESCRIPTION><![CDATA[Represents the credit payment that has been used]]></DESCRIPTION>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <HELP><![CDATA[Represents the credit payment that has been used]]></HELP>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <AD_COLUMN_ID><![CDATA[ADFFC3EEE6118D7AE040007F01013D8C]]></AD_COLUMN_ID>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADFFEB0194FF7FBCE040007F01013E25-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADFFEB0194FF7FBCE040007F01013E25--></AD_FIELD>
+
 <!--AEAEFFCA2F7D4E8592C60863B54836E2--><AD_FIELD>
 <!--AEAEFFCA2F7D4E8592C60863B54836E2-->  <AD_FIELD_ID><![CDATA[AEAEFFCA2F7D4E8592C60863B54836E2]]></AD_FIELD_ID>
 <!--AEAEFFCA2F7D4E8592C60863B54836E2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -3883,6 +3883,54 @@
 <!--AE4ED865065A432AB641E859FA02686F-->  <NAME><![CDATA[jdbc/openbravo]]></NAME>
 <!--AE4ED865065A432AB641E859FA02686F--></AD_MODEL_OBJECT>
 
+<!--AE66869F3A94350BE040007F0101424C--><AD_MODEL_OBJECT>
+<!--AE66869F3A94350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A94350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A94350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A94350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A94350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A94350BE040007F0101424C-->  <ACTION><![CDATA[W]]></ACTION>
+<!--AE66869F3A94350BE040007F0101424C-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--AE66869F3A94350BE040007F0101424C-->  <CLASSNAME><![CDATA[org.openbravo.erpWindows.PaymentIn.UsedCreditSource]]></CLASSNAME>
+<!--AE66869F3A94350BE040007F0101424C-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--AE66869F3A94350BE040007F0101424C-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--AE66869F3A94350BE040007F0101424C--></AD_MODEL_OBJECT>
+
+<!--AE66869F3A98350BE040007F0101424C--><AD_MODEL_OBJECT>
+<!--AE66869F3A98350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A98350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A98350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A98350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A98350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A98350BE040007F0101424C-->  <ACTION><![CDATA[W]]></ACTION>
+<!--AE66869F3A98350BE040007F0101424C-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--AE66869F3A98350BE040007F0101424C-->  <CLASSNAME><![CDATA[org.openbravo.erpCommon.ad_callouts.ComboReloadsFF80818132AF937F0132AFA84F97003A]]></CLASSNAME>
+<!--AE66869F3A98350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A98350BE040007F0101424C-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--AE66869F3A98350BE040007F0101424C--></AD_MODEL_OBJECT>
+
+<!--AE66869F3A9A350BE040007F0101424C--><AD_MODEL_OBJECT>
+<!--AE66869F3A9A350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A9A350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A9A350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A9A350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A9A350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A9A350BE040007F0101424C-->  <ACTION><![CDATA[W]]></ACTION>
+<!--AE66869F3A9A350BE040007F0101424C-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--AE66869F3A9A350BE040007F0101424C-->  <CLASSNAME><![CDATA[org.openbravo.erpWindows.PaymentOut.UsedCreditSource]]></CLASSNAME>
+<!--AE66869F3A9A350BE040007F0101424C-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--AE66869F3A9A350BE040007F0101424C-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--AE66869F3A9A350BE040007F0101424C--></AD_MODEL_OBJECT>
+
+<!--AE66869F3A9E350BE040007F0101424C--><AD_MODEL_OBJECT>
+<!--AE66869F3A9E350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A9E350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A9E350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A9E350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A9E350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A9E350BE040007F0101424C-->  <ACTION><![CDATA[W]]></ACTION>
+<!--AE66869F3A9E350BE040007F0101424C-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--AE66869F3A9E350BE040007F0101424C-->  <CLASSNAME><![CDATA[org.openbravo.erpCommon.ad_callouts.ComboReloadsFF80818132AFC4050132AFC7F94A000A]]></CLASSNAME>
+<!--AE66869F3A9E350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A9E350BE040007F0101424C-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--AE66869F3A9E350BE040007F0101424C--></AD_MODEL_OBJECT>
+
 <!--B5FE07148F9C4A818027E2C8D628516B--><AD_MODEL_OBJECT>
 <!--B5FE07148F9C4A818027E2C8D628516B-->  <AD_MODEL_OBJECT_ID><![CDATA[B5FE07148F9C4A818027E2C8D628516B]]></AD_MODEL_OBJECT_ID>
 <!--B5FE07148F9C4A818027E2C8D628516B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -4110,6 +4110,86 @@
 <!--ACF55029BBC7476AA1EB6C502EDE5BA9-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
 <!--ACF55029BBC7476AA1EB6C502EDE5BA9--></AD_MODEL_OBJECT_MAPPING>
 
+<!--AE66869F3A95350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A95350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A95350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A95350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A95350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A95350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A95350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A94350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A95350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/PaymentIn/UsedCreditSource_Relation.html]]></MAPPINGNAME>
+<!--AE66869F3A95350BE040007F0101424C-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--AE66869F3A95350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
+<!--AE66869F3A96350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A96350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A96350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A96350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A96350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A96350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A96350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A94350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A96350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/PaymentIn/UsedCreditSource_Edition.html]]></MAPPINGNAME>
+<!--AE66869F3A96350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A96350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
+<!--AE66869F3A97350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A97350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A97350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A97350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A97350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A97350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A97350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A94350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A97350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/PaymentIn/UsedCreditSource_Excel.xls]]></MAPPINGNAME>
+<!--AE66869F3A97350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A97350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
+<!--AE66869F3A99350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A99350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A99350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A99350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A99350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A99350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A99350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A98350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A99350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/ad_callouts/ComboReloadsFF80818132AF937F0132AFA84F97003A.html]]></MAPPINGNAME>
+<!--AE66869F3A99350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A99350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
+<!--AE66869F3A9B350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A9B350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A9B350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A9B350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A9B350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A9B350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A9B350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A9A350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A9B350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/PaymentOut/UsedCreditSource_Relation.html]]></MAPPINGNAME>
+<!--AE66869F3A9B350BE040007F0101424C-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--AE66869F3A9B350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
+<!--AE66869F3A9C350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A9C350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A9C350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A9C350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A9C350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A9C350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A9C350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A9A350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A9C350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/PaymentOut/UsedCreditSource_Edition.html]]></MAPPINGNAME>
+<!--AE66869F3A9C350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A9C350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
+<!--AE66869F3A9D350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A9D350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A9D350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A9D350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A9D350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A9D350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A9D350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A9A350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A9D350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/PaymentOut/UsedCreditSource_Excel.xls]]></MAPPINGNAME>
+<!--AE66869F3A9D350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A9D350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
+<!--AE66869F3A9F350BE040007F0101424C--><AD_MODEL_OBJECT_MAPPING>
+<!--AE66869F3A9F350BE040007F0101424C-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AE66869F3A9F350BE040007F0101424C]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--AE66869F3A9F350BE040007F0101424C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AE66869F3A9F350BE040007F0101424C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AE66869F3A9F350BE040007F0101424C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AE66869F3A9F350BE040007F0101424C-->  <AD_MODEL_OBJECT_ID><![CDATA[AE66869F3A9E350BE040007F0101424C]]></AD_MODEL_OBJECT_ID>
+<!--AE66869F3A9F350BE040007F0101424C-->  <MAPPINGNAME><![CDATA[/ad_callouts/ComboReloadsFF80818132AFC4050132AFC7F94A000A.html]]></MAPPINGNAME>
+<!--AE66869F3A9F350BE040007F0101424C-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--AE66869F3A9F350BE040007F0101424C--></AD_MODEL_OBJECT_MAPPING>
+
 <!--AFEFA3ECE5E543C8BFCB049F0208577F--><AD_MODEL_OBJECT_MAPPING>
 <!--AFEFA3ECE5E543C8BFCB049F0208577F-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[AFEFA3ECE5E543C8BFCB049F0208577F]]></AD_MODEL_OBJECT_MAPPING_ID>
 <!--AFEFA3ECE5E543C8BFCB049F0208577F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_REFERENCE.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_REFERENCE.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -4519,6 +4519,18 @@
 <!--5D4B2983E0254AA1B60A82A7B92DB67D-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--5D4B2983E0254AA1B60A82A7B92DB67D--></AD_REFERENCE>
 
+<!--5E77652CBFEB4F03A3A0629642D024DD--><AD_REFERENCE>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_REFERENCE_ID><![CDATA[5E77652CBFEB4F03A3A0629642D024DD]]></AD_REFERENCE_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <NAME><![CDATA[FIN_Payment]]></NAME>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <PARENTREFERENCE_ID><![CDATA[18]]></PARENTREFERENCE_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--5E77652CBFEB4F03A3A0629642D024DD--></AD_REFERENCE>
+
 <!--60E231391A7348DDA7171E780F62EF99--><AD_REFERENCE>
 <!--60E231391A7348DDA7171E780F62EF99-->  <AD_REFERENCE_ID><![CDATA[60E231391A7348DDA7171E780F62EF99]]></AD_REFERENCE_ID>
 <!--60E231391A7348DDA7171E780F62EF99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_REF_TABLE.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_REF_TABLE.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -1131,6 +1131,17 @@
 <!--595E4FB3F743477BA5A670452556C3DF-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--595E4FB3F743477BA5A670452556C3DF--></AD_REF_TABLE>
 
+<!--5E77652CBFEB4F03A3A0629642D024DD--><AD_REF_TABLE>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_REFERENCE_ID><![CDATA[5E77652CBFEB4F03A3A0629642D024DD]]></AD_REFERENCE_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_TABLE_ID><![CDATA[D1A97202E832470285C9B1EB026D54E2]]></AD_TABLE_ID>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_KEY><![CDATA[7891269C83D0655DE040007F010155CE]]></AD_KEY>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <AD_DISPLAY><![CDATA[7891269C83E0655DE040007F010155CE]]></AD_DISPLAY>
+<!--5E77652CBFEB4F03A3A0629642D024DD-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--5E77652CBFEB4F03A3A0629642D024DD--></AD_REF_TABLE>
+
 <!--65447418FD4D428CA025AC9AF26ADA21--><AD_REF_TABLE>
 <!--65447418FD4D428CA025AC9AF26ADA21-->  <AD_REFERENCE_ID><![CDATA[65447418FD4D428CA025AC9AF26ADA21]]></AD_REFERENCE_ID>
 <!--65447418FD4D428CA025AC9AF26ADA21-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TAB.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_TAB.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -12320,4 +12320,54 @@
 <!--FF808181309036230130905FCB450044-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
 <!--FF808181309036230130905FCB450044--></AD_TAB>
 
+<!--FF80818132AF937F0132AFA84F97003A--><AD_TAB>
+<!--FF80818132AF937F0132AFA84F97003A-->  <AD_TAB_ID><![CDATA[FF80818132AF937F0132AFA84F97003A]]></AD_TAB_ID>
+<!--FF80818132AF937F0132AFA84F97003A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF80818132AF937F0132AFA84F97003A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF80818132AF937F0132AFA84F97003A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF80818132AF937F0132AFA84F97003A-->  <NAME><![CDATA[Used Credit Source]]></NAME>
+<!--FF80818132AF937F0132AFA84F97003A-->  <DESCRIPTION><![CDATA[Tracks the places where the credit payment is used]]></DESCRIPTION>
+<!--FF80818132AF937F0132AFA84F97003A-->  <HELP><![CDATA[A credit payment can be used in several payments. This table tracks the places where the credit has been used]]></HELP>
+<!--FF80818132AF937F0132AFA84F97003A-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--FF80818132AF937F0132AFA84F97003A-->  <AD_WINDOW_ID><![CDATA[E547CE89D4C04429B6340FFA44E70716]]></AD_WINDOW_ID>
+<!--FF80818132AF937F0132AFA84F97003A-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--FF80818132AF937F0132AFA84F97003A-->  <TABLEVEL><![CDATA[1]]></TABLEVEL>
+<!--FF80818132AF937F0132AFA84F97003A-->  <ISSINGLEROW><![CDATA[N]]></ISSINGLEROW>
+<!--FF80818132AF937F0132AFA84F97003A-->  <ISINFOTAB><![CDATA[N]]></ISINFOTAB>
+<!--FF80818132AF937F0132AFA84F97003A-->  <ISTRANSLATIONTAB><![CDATA[N]]></ISTRANSLATIONTAB>
+<!--FF80818132AF937F0132AFA84F97003A-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--FF80818132AF937F0132AFA84F97003A-->  <HASTREE><![CDATA[N]]></HASTREE>
+<!--FF80818132AF937F0132AFA84F97003A-->  <PROCESSING><![CDATA[N]]></PROCESSING>
+<!--FF80818132AF937F0132AFA84F97003A-->  <IMPORTFIELDS><![CDATA[N]]></IMPORTFIELDS>
+<!--FF80818132AF937F0132AFA84F97003A-->  <ISSORTTAB><![CDATA[N]]></ISSORTTAB>
+<!--FF80818132AF937F0132AFA84F97003A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF80818132AF937F0132AFA84F97003A-->  <UIPATTERN><![CDATA[RO]]></UIPATTERN>
+<!--FF80818132AF937F0132AFA84F97003A-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
+<!--FF80818132AF937F0132AFA84F97003A--></AD_TAB>
+
+<!--FF80818132AFC4050132AFC7F94A000A--><AD_TAB>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <AD_TAB_ID><![CDATA[FF80818132AFC4050132AFC7F94A000A]]></AD_TAB_ID>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <NAME><![CDATA[Used Credit Source]]></NAME>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <DESCRIPTION><![CDATA[Tracks the places where the credit payment is used]]></DESCRIPTION>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <HELP><![CDATA[A credit payment can be used in several payments. This table tracks the places where the credit has been used]]></HELP>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <AD_WINDOW_ID><![CDATA[6F8F913FA60F4CBD93DC1D3AA696E76E]]></AD_WINDOW_ID>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <TABLEVEL><![CDATA[1]]></TABLEVEL>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <ISSINGLEROW><![CDATA[N]]></ISSINGLEROW>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <ISINFOTAB><![CDATA[N]]></ISINFOTAB>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <ISTRANSLATIONTAB><![CDATA[N]]></ISTRANSLATIONTAB>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <HASTREE><![CDATA[N]]></HASTREE>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <PROCESSING><![CDATA[N]]></PROCESSING>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <IMPORTFIELDS><![CDATA[N]]></IMPORTFIELDS>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <ISSORTTAB><![CDATA[N]]></ISSORTTAB>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <UIPATTERN><![CDATA[RO]]></UIPATTERN>
+<!--FF80818132AFC4050132AFC7F94A000A-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
+<!--FF80818132AFC4050132AFC7F94A000A--></AD_TAB>
+
 </data>
--- a/src-db/database/sourcedata/AD_TABLE.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_TABLE.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -9772,4 +9772,28 @@
 <!--FF808181308EA42301308FB5F7BC0049-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1D44B84E040007F01006125]]></AD_PACKAGE_ID>
 <!--FF808181308EA42301308FB5F7BC0049--></AD_TABLE>
 
+<!--FF80818132AF937F0132AF9E94FF0013--><AD_TABLE>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <AD_TABLE_ID><![CDATA[FF80818132AF937F0132AF9E94FF0013]]></AD_TABLE_ID>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <NAME><![CDATA[FIN_Payment_Credit]]></NAME>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <DESCRIPTION><![CDATA[Tracks the places where the credit payment is used]]></DESCRIPTION>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <HELP><![CDATA[A credit payment can be used in several payments. This table tracks the places where the credit has been used]]></HELP>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <TABLENAME><![CDATA[FIN_Payment_Credit]]></TABLENAME>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <CLASSNAME><![CDATA[FIN_Payment_Credit]]></CLASSNAME>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ISVIEW><![CDATA[N]]></ISVIEW>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ACCESSLEVEL><![CDATA[1]]></ACCESSLEVEL>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <AD_WINDOW_ID><![CDATA[E547CE89D4C04429B6340FFA44E70716]]></AD_WINDOW_ID>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ISSECURITYENABLED><![CDATA[N]]></ISSECURITYENABLED>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ISDELETEABLE><![CDATA[Y]]></ISDELETEABLE>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ISHIGHVOLUME><![CDATA[N]]></ISHIGHVOLUME>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <IMPORTTABLE><![CDATA[N]]></IMPORTTABLE>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <PO_WINDOW_ID><![CDATA[6F8F913FA60F4CBD93DC1D3AA696E76E]]></PO_WINDOW_ID>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--FF80818132AF937F0132AF9E94FF0013-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1E64B84E040007F01006125]]></AD_PACKAGE_ID>
+<!--FF80818132AF937F0132AF9E94FF0013--></AD_TABLE>
+
 </data>
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -19322,6 +19322,94 @@
 <!--AE7B8660F2B811DDA8F4001D09C4A2FE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--AE7B8660F2B811DDA8F4001D09C4A2FE--></AD_TEXTINTERFACES>
 
+<!--AEA335E1B37030CDE040007F01015C39--><AD_TEXTINTERFACES>
+<!--AEA335E1B37030CDE040007F01015C39-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA335E1B37030CDE040007F01015C39]]></AD_TEXTINTERFACES_ID>
+<!--AEA335E1B37030CDE040007F01015C39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA335E1B37030CDE040007F01015C39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA335E1B37030CDE040007F01015C39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA335E1B37030CDE040007F01015C39-->  <TEXT><![CDATA[Select Credit Payments]]></TEXT>
+<!--AEA335E1B37030CDE040007F01015C39-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html]]></FILENAME>
+<!--AEA335E1B37030CDE040007F01015C39-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA335E1B37030CDE040007F01015C39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA335E1B37030CDE040007F01015C39--></AD_TEXTINTERFACES>
+
+<!--AEA335E1B37230CDE040007F01015C39--><AD_TEXTINTERFACES>
+<!--AEA335E1B37230CDE040007F01015C39-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA335E1B37230CDE040007F01015C39]]></AD_TEXTINTERFACES_ID>
+<!--AEA335E1B37230CDE040007F01015C39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA335E1B37230CDE040007F01015C39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA335E1B37230CDE040007F01015C39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA335E1B37230CDE040007F01015C39-->  <TEXT><![CDATA[Use Credit Payment]]></TEXT>
+<!--AEA335E1B37230CDE040007F01015C39-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html]]></FILENAME>
+<!--AEA335E1B37230CDE040007F01015C39-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA335E1B37230CDE040007F01015C39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA335E1B37230CDE040007F01015C39--></AD_TEXTINTERFACES>
+
+<!--AEA335E1B37430CDE040007F01015C39--><AD_TEXTINTERFACES>
+<!--AEA335E1B37430CDE040007F01015C39-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA335E1B37430CDE040007F01015C39]]></AD_TEXTINTERFACES_ID>
+<!--AEA335E1B37430CDE040007F01015C39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA335E1B37430CDE040007F01015C39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA335E1B37430CDE040007F01015C39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA335E1B37430CDE040007F01015C39-->  <TEXT><![CDATA[Total Gross Amount]]></TEXT>
+<!--AEA335E1B37430CDE040007F01015C39-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html]]></FILENAME>
+<!--AEA335E1B37430CDE040007F01015C39-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA335E1B37430CDE040007F01015C39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA335E1B37430CDE040007F01015C39--></AD_TEXTINTERFACES>
+
+<!--AEA335E1B37630CDE040007F01015C39--><AD_TEXTINTERFACES>
+<!--AEA335E1B37630CDE040007F01015C39-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA335E1B37630CDE040007F01015C39]]></AD_TEXTINTERFACES_ID>
+<!--AEA335E1B37630CDE040007F01015C39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA335E1B37630CDE040007F01015C39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA335E1B37630CDE040007F01015C39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA335E1B37630CDE040007F01015C39-->  <TEXT><![CDATA[Credit to be used]]></TEXT>
+<!--AEA335E1B37630CDE040007F01015C39-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html]]></FILENAME>
+<!--AEA335E1B37630CDE040007F01015C39-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA335E1B37630CDE040007F01015C39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA335E1B37630CDE040007F01015C39--></AD_TEXTINTERFACES>
+
+<!--AEA335E1B37830CDE040007F01015C39--><AD_TEXTINTERFACES>
+<!--AEA335E1B37830CDE040007F01015C39-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA335E1B37830CDE040007F01015C39]]></AD_TEXTINTERFACES_ID>
+<!--AEA335E1B37830CDE040007F01015C39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA335E1B37830CDE040007F01015C39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA335E1B37830CDE040007F01015C39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA335E1B37830CDE040007F01015C39-->  <TEXT><![CDATA[Credit Payment No]]></TEXT>
+<!--AEA335E1B37830CDE040007F01015C39-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html]]></FILENAME>
+<!--AEA335E1B37830CDE040007F01015C39-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA335E1B37830CDE040007F01015C39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA335E1B37830CDE040007F01015C39--></AD_TEXTINTERFACES>
+
+<!--AEA335E1B37A30CDE040007F01015C39--><AD_TEXTINTERFACES>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA335E1B37A30CDE040007F01015C39]]></AD_TEXTINTERFACES_ID>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <TEXT><![CDATA[Payment Date]]></TEXT>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html]]></FILENAME>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA335E1B37A30CDE040007F01015C39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA335E1B37A30CDE040007F01015C39--></AD_TEXTINTERFACES>
+
+<!--AEA335E1B37C30CDE040007F01015C39--><AD_TEXTINTERFACES>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA335E1B37C30CDE040007F01015C39]]></AD_TEXTINTERFACES_ID>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <TEXT><![CDATA[Outstanding Amount]]></TEXT>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html]]></FILENAME>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA335E1B37C30CDE040007F01015C39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA335E1B37C30CDE040007F01015C39--></AD_TEXTINTERFACES>
+
+<!--AEA33AB7C2CD17B4E040007F01015CA1--><AD_TEXTINTERFACES>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <AD_TEXTINTERFACES_ID><![CDATA[AEA33AB7C2CD17B4E040007F01015CA1]]></AD_TEXTINTERFACES_ID>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <TEXT><![CDATA[Out of range]]></TEXT>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_actionButton/AddCreditPaymentGrid.srpt]]></FILENAME>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--AEA33AB7C2CD17B4E040007F01015CA1-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--AEA33AB7C2CD17B4E040007F01015CA1--></AD_TEXTINTERFACES>
+
 <!--AEB4114777D14A2988B8937F98CAFA16--><AD_TEXTINTERFACES>
 <!--AEB4114777D14A2988B8937F98CAFA16-->  <AD_TEXTINTERFACES_ID><![CDATA[AEB4114777D14A2988B8937F98CAFA16]]></AD_TEXTINTERFACES_ID>
 <!--AEB4114777D14A2988B8937F98CAFA16-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-wad/src/org/openbravo/wad/Template_ActionButton.html	Sun Nov 06 12:28:23 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Template_ActionButton.html	Mon Nov 07 14:22:37 2011 +0100
@@ -99,6 +99,7 @@
 </script>
 </head>
 <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="onLoadDo();">
+<iframe name="hiddenFrame" style="display:none;"></iframe>
 <form id="form" method="post" action="Window_Edition.html" name="frmMain">
 <input type="hidden" name="Command">
 <input type="hidden" name="inpLastFieldChanged">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/AddCreditPaymentGrid.srpt	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+-->
+<div id="sectionLinesDetail">
+  <input type="hidden" name="inpRecordIdxx" value="" id="fieldRecordId"/>
+  <input type="hidden" name="inpRecordAmtxx" value="" id="fieldRecordAmt"/>
+  <tr id="funcEvenOddRow" class="DataGrid_Body_Row DataGrid_Body_Row_xx" bgcolor="#E1E1E1">
+    <td class="DataGrid_Body_LineNoCell"> <input type="checkbox" name="inpCreditPaymentId" value="" id="fieldCreditPaymentId" onclick="updateData(this.value, this.checked, true);return true;"/></td>
+    <td class="DataGrid_Body_Cell" id="fieldDocumentNo">xx50010</td>
+    <td class="DataGrid_Body_Cell" id="fieldDescription">xxPaymentDescription</td>
+    <td class="DataGrid_Body_Cell" id="fieldDocumentDate">xx12/12/2009</td>
+    <td class="DataGrid_Body_Cell_Amount" id="fieldOutstandingAmount">xx60.00</td>
+    <td class="DataGrid_Body_Cell_Amount">
+      <input type="text"
+      onkeyup="" name="inpPaymentAmountxx" maxlength="22" value=""
+      class="dojoValidateValid TextBox_btn_OneCell_width number TextBox required"
+      id="inpPaymentAmount"
+      outputformat="euroEdition"
+      onfocus="numberInputEvent('onfocus', this);" onblur="numberInputEvent('onblur', this);" onkeydown="numberInputEvent('onkeydown', this, event);"
+      onchange="paymentAmountOnChange(this);" />
+
+      <span id="paraminvalidSpanxx" style="display: none;" class="TextBox_MsgContainer_span">
+        <table class="TextBox_MsgContainer_table">
+          <tbody>
+            <tr class="TextBox_MsgContainer_tr">
+              <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td>
+            </tr>
+            <tr>
+              <td class="invalid" colspan="2"><div id="paramGridLineAmountinvalidSpanText" class="TextBox_MsgContainer_div2">Out of range</div></td>
+            </tr>
+          </tbody>
+        </table>
+      </span>
+
+    </td>
+  </tr>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/AddCreditPaymentGrid.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+-->
+<REPORT>
+  <template file="AddCreditPaymentGrid.srpt"/> 
+
+  <structure name="structure">
+    <FIELD id="fieldSelectedCreditPaymentId" attribute="value">finSelectedCreditPaymentId</FIELD>
+    <FIELD id="fieldCreditPaymentId" attribute="value">finCreditPaymentId</FIELD>
+    <FIELD id="fieldCreditPaymentId" boolean="checked" withId="fieldSelectedCreditPaymentId">finCreditPaymentId</FIELD>
+    <FIELD id="fieldRecordId" attribute="value">finCreditPaymentId</FIELD>
+    <FIELD id="fieldRecordId" attribute="name" replace="xx">rownum</FIELD>
+    <FIELD id="fieldRecordAmt" attribute="value" format="euroEdition">outstandingAmount</FIELD>
+    <FIELD id="fieldRecordAmt" attribute="name" replace="xx">finCreditPaymentId</FIELD>
+    <FIELD id="fieldDocumentNo">documentNo</FIELD>
+    <FIELD id="fieldDescription">paymentDescription</FIELD>
+    <FIELD id="fieldDocumentDate">documentDate</FIELD>
+    <FIELD id="fieldOutstandingAmount" format="euroEdition">outstandingAmount</FIELD>
+    <FIELD id="inpPaymentAmount" attribute="name" replace="xx">finCreditPaymentId</FIELD>
+    <FIELD id="inpPaymentAmount" attribute="value" format="euroEdition">paymentAmount</FIELD>
+    <FIELD id="funcEvenOddRow" attribute="bgcolor" replace="#E1E1E1">gridLineColor</FIELD>
+    <FIELD id="paraminvalidSpanxx" attribute="id" replace="xx">finCreditPaymentId</FIELD>
+
+    <SECTION id="sectionLinesDetail"/>
+  </structure>
+  <DISCARD id="discard"/>
+</REPORT>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.html	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,570 @@
+<!--
+*************************************************************************
+* The contents of this file are subject to the Openbravo  Public  License
+* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+* Version 1.1  with a permitted attribution clause; you may not  use this
+* file except in compliance with the License. You  may  obtain  a copy of
+* the License at http://www.openbravo.com/legal/license.html 
+* Software distributed under the License  is  distributed  on  an "AS IS"
+* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+* License for the specific  language  governing  rights  and  limitations
+* under the License. 
+* The Original Code is Openbravo ERP. 
+* The Initial Developer of the Original Code is Openbravo SLU 
+* All portions are Copyright (C) 2011 Openbravo SLU 
+* All Rights Reserved. 
+* Contributor(s):  ______________________________________.
+************************************************************************
+-->
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Select Credit Payments</title>
+    <link rel="shortcut icon" href="../../../../../web/images/favicon.ico" type="image/x-icon" />
+    <link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Openbravo_ERP_250.css" id="paramCSS"></link>
+    <script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/dojoConfig.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/dojo/dojo.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/jscalendar/calendar.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/jscalendar/lang/calendar-es.js" type="text/javascript" id="fieldCalendar"></script>
+    <script language="JavaScript" src="../../../../../web/js/default/DateTextBox.js" type="text/javascript"></script>
+    <script language="JavaScript" type="text/javascript" id="paramLanguage">defaultLang = "en_US";</script>
+    <script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/appStatus.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/js/default/MessageBox.js" type="text/javascript"></script>   
+    <script language="JavaScript" src="../../../../../web/js/searchs.js" type="text/javascript"></script>
+    <script language="JavaScript" src="../../../../../web/org.openbravo.advpaymentmngt/FIN_Utilities.js" type="text/javascript"></script>
+    <script type="text/javascript">
+    //  window.onunload = reloadOpener; // reloads opener on closing
+      dojo.hostenv.writeIncludes(); //makes debugging in Venkman possible
+    </script>
+    <script language="JavaScript" type="text/javascript" id="paramDirectory">
+      var baseDirectory="../../../../../web/";
+    </script>
+    <script language="JavaScript" type="text/javascript" id="paramArray">
+      var arrDocAction = null;
+    </script>
+    <script language="JavaScript" type="text/javascript">
+      function submitThisPage(strCommand) {
+        if (validate()){
+          setProcessingMode('popup', true);
+          submitCommandForm(strCommand, false, null, null, '_self');
+        }
+        return true;
+      }
+    </script>
+
+    <script language="JavaScript" type="text/javascript">
+    function onLoadDo(){
+        setProcessingMode('popup', false);
+        this.windowTables = new Array(
+          new windowTableId('client', 'buttonOK')
+        );
+        setWindowTableParentElement();
+        enableShortcuts('popup');
+        setBrowserAutoComplete(false);
+
+        loadGridList();
+        reloadOpener();
+        initFIN_Utilities(document.frmMain);
+        setWindowElementFocus('firstElement');
+    }
+
+    function onResizeDo(){
+    }
+    
+    function validate(action, form, value) {
+      var frm=document.frmMain;
+      if (frm.inpPaymentDate.value==null || frm.inpPaymentDate.value=="") {
+        setWindowElementFocus(frm.inpPaymentDate);
+        showJSMessage(7);
+        return false;
+      }
+      
+      var expectedAmt = frm.inpExpectedPayment.value || 0;
+      var invoiceAmt = frm.inpInvoiceGrossAmt.value;      
+      if ( compare(expectedAmt, '>', invoiceAmt) ) {
+        setWindowElementFocus(frm.inpExpectedPayment);
+        showJSMessage('APRM_JSMOREAMOUTALLOCATED');
+        return false;
+      }
+      
+      for (i=0; i < frm.elements.length; i++) {
+        var tag = frm.elements[i].name.slice(0, "inpPaymentAmount".length);
+        if (tag === "inpPaymentAmount") {
+          if (!validatePaymentAmt(frm.elements[i])) {
+            setWindowElementFocus(frm.elements[i]);
+            showJSMessage('APRM_JSMOREAMOUTALLOCATED');
+            return false;
+          }
+        }
+      }
+      setProcessingMode('popup', true);
+      return true;
+   }
+   function validatePaymentAmt(element) {
+     var id = element.name.slice("inpPaymentAmount".length);
+     var outStandingAmount = frm.elements["inpRecordAmt" + id].value || 0;
+     var amount = element.value || 0;
+     var invalidSpan = document.getElementById('paraminvalidSpan'+id);
+     if (invalidSpan) {
+       var valid = isBetweenZeroAndMaxValue(amount, outStandingAmount);
+       document.getElementById('paraminvalidSpan'+id).style.display = !valid ? 'block' : 'none';
+       if (!valid) {
+         return false;
+       }
+     }
+     return true;
+   }
+   function validateDate(element){
+     isValidDate(element.value, element.getAttribute("displayformat"))
+   }
+   
+    </script>
+<script language="JavaScript" type="text/javascript">
+function loadGridList() {
+  try {
+    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/ProcessInvoice.html";
+    var paramXMLReq = null;
+    return submitXmlHttpRequest(callBackGrid, document.frmMain, "GRIDLIST", url, false, null, paramXMLReq);
+  } catch (e) {
+    alert(e);
+  }
+}
+
+function callBackGrid(paramXMLParticular, XMLHttpRequestObj) {
+  var strText = "";
+  if (getReadyStateHandler(XMLHttpRequestObj)) {
+    try {
+      if (XMLHttpRequestObj.responseText) {
+        strText = XMLHttpRequestObj.responseText;
+        var aux = strText.substring(29, strText.length-8);
+        var tableBody = document.getElementById('sectionGrid');
+        var browserName = getBrowserInfo('name');
+        if (browserName.toUpperCase().indexOf('INTERNET EXPLORER') != -1) {
+          var temp = document.createElement("span");
+          temp.id = 'temp';
+          temp.style.display = 'none';
+          var newRows = '<table><tbody id=\"sectionGrid\">'+ aux;
+          temp.innerHTML = newRows;
+          tableBody.parentNode.replaceChild(temp.firstChild.firstChild, tableBody);
+          temp.parentNode.removeChild(temp);
+        }
+        tableBody.innerHTML = aux;
+        
+        reloadOpener();
+        updateExpectedAmt();
+      } else {
+        document.getElementById('sectionGrid').innerHTML = '';
+      }
+    } catch (e) {
+    }
+  }
+  return true;
+}
+</script>
+<script type="text/javascript">
+function paymentAmountOnChange(element){
+  validatePaymentAmt(element);
+  updateExpectedAmt();
+  numberInputEvent('onchange', element);
+}
+function updateExpectedAmt() {
+  frm.inpExpectedPayment.value = 0;
+  var i;
+  for (i=0; i < frm.elements.length; i++) {
+    var tag = frm.elements[i].name.slice(0, "inpPaymentAmount".length);
+    if (tag === "inpPaymentAmount") {
+      frm.inpExpectedPayment.value = add(frm.inpExpectedPayment.value, frm.elements[i].value || 0);
+      if (!frm.elements[i].value) {
+        updateReadOnly(frm.elements[i].name.slice("inpPaymentAmount".length), false);
+      }
+    }
+  }
+  numberInputEvent('onchange', frm.elements["inpExpectedPayment"]);
+}
+
+function updateReadOnly(key, mark) {
+  if (mark === null) {
+    mark = false;
+  }
+  frm.elements["inpPaymentAmount" + key].disabled = !mark;
+
+  if (mark) {
+    frm.elements["inpPaymentAmount" + key].className = frm.elements["inpPaymentAmount" + key].className.replace(' readonly', '');
+  } else {
+    var classText = frm.elements["inpPaymentAmount" + key].className;
+    if (classText.search('readonly') === -1) {
+      frm.elements["inpPaymentAmount" + key].className = classText.concat(" readonly");
+    }
+    frm.elements["inpPaymentAmount" + key].value = '';
+    invalidSpan = document.getElementById('paraminvalidSpan'+key);
+    if (invalidSpan) {
+      document.getElementById('paraminvalidSpan'+key).style.display = 'none';
+    }
+  }
+
+  return true;
+}
+
+function updateData(key, mark) {
+  if (mark==null) mark=false;
+  if (mark) {
+    distributeAmt(key);
+  }
+  updateReadOnly(key, mark);
+  updateExpectedAmt();
+  return true;
+}
+
+function distributeAmt(key){
+  var invoiceAmount = frm.inpInvoiceGrossAmt.value || 0;
+  var expectedAmount = frm.inpExpectedPayment.value || 0;
+  var outStandingAmount = frm.elements["inpRecordAmt" + key].value || 0;
+  
+  var pendingToPay = subtract(invoiceAmount, expectedAmount);
+  if (compare(pendingToPay, '>', 0)) {
+    if (compare(outStandingAmount, '>=', pendingToPay)) {
+      frm.elements["inpPaymentAmount" + key].value = pendingToPay;
+    } else {
+      frm.elements["inpPaymentAmount" + key].value = outStandingAmount;
+    }
+  }
+  numberInputEvent('onchange', frm.elements["inpPaymentAmount" + key]);
+}
+</script>
+</head>
+
+<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="onLoadDo();" onresize="onResizeDo();">
+  <form id="form" method="post" action="ProcessInvoice.html" name="frmMain">
+    <input type="hidden" name="Command">
+    <input type="hidden" name="IsPopUpCall" value="1"></input>
+    <input type="hidden" name="inpKey" value="" id="key"></input>
+    <input type="hidden" name="inpwindowId" value="" id="window"></input>
+    <input type="hidden" name="inpTabId" value="" id="tab"></input>
+    <input type="hidden" name="inpadOrgId" value="" id="adOrgId"></input>
+    
+    <div class="Popup_ContentPane_CircleLogo">
+      <div class="Popup_WindowLogo">
+	<img class="Popup_WindowLogo_Icon Popup_WindowLogo_Icon_process" src="../../../../../web/images/blank.gif" border=0/></img>
+      </div>
+    </div>
+    <table cellspacing="0" cellpadding="0" width="100%" id="table_header">
+      <tr>
+	<td>
+          <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_NavBar">
+            <tr class="Popup_NavBar_bg"><td></td>
+              <td class="Popup_NavBar_separator_cell"></td>
+              <td class="Popup_NavBar_bg_logo_left"></td>
+              <td class="Popup_NavBar_bg_logo" width="1" onclick="openNewBrowser('http://www.openbravo.com', 'Openbravo');return false;"><img src="../../../../../web/images/blank.gif" alt="Openbravo" title="Openbravo" border="0" id="openbravoLogo" class="Popup_NavBar_logo" /></td>
+              <td class="Popup_NavBar_bg_logo_right"></td>
+              <td class="Popup_NavBar_Popup_title_cell"><span name="lbl" id="lblPopupTitle">Use Credit Payment</span></td>
+              <td class="Popup_NavBar_separator_cell"></td>
+            </tr>
+          </table>
+	</td>
+      </tr>
+      <tr>
+	<td>
+          <table cellspacing="0" cellpadding="0" class="Popup_ContentPane_SeparatorBar">
+            <tr>
+              <td class="Popup_SeparatorBar_bg"></td>
+            </tr>
+          </table>
+	</td>
+      </tr>
+    </table>
+
+    <table cellspacing="0" cellpadding="0" width="100%">
+      <tr>
+	<td>
+          <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client_messagebox">
+
+            <!-- MessageBox -->
+            <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxyy">
+              <tbody>
+		<tr class="MessageBox_TopMargin">
+		  <td class="MessageBox_LeftMargin"></td>
+		  <td></td>
+		  <td class="MessageBox_RightMargin"></td>
+		</tr>
+		<tr>
+		  <td class="MessageBox_LeftMargin"></td>
+		  <td>
+
+                    <table cellpadding="0" cellspacing="0" class="MessageBox_Container">
+                      <tbody>
+			<tr>
+			  <td class="MessageBox_LeftTrans">
+			    <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
+                              <tbody>
+				<tr>
+				  <td class="MessageBox_TopLeft"></td>
+				</tr>
+				<tr>
+				  <td class="MessageBox_Left"></td>
+				</tr>
+                              </tbody>
+			    </table>
+			  </td>
+			  <td class="MessageBox_bg">
+
+			    <table class="MessageBox_Top">
+			      <tbody>
+				<tr>
+				  <td>
+				    <span>
+				      <table cellpadding="0" cellspacing="0" class="MessageBox_Body_ContentCell">
+					<tbody>
+					  <tr>
+					    <td class="MessageBox_Icon_ContentCell">
+					      <div class="MessageBox_Icon"></div>
+					    </td>
+					    <td style="vertical-align: top;" id="messageBoxIDContent">
+					      <span>
+						<div class="MessageBox_TextTitle" id="messageBoxIDTitle">
+						  xxInfo: AccessTableWithNoView
+						</div>
+						<div class="MessageBox_TextDescription" id="messageBoxIDMessage">
+						  xxThe current information is empty.
+						</div>
+						<div class="MessageBox_TextSeparator"></div>
+					      </span>
+					    </td>
+					  </tr>
+					</tbody>
+				      </table>
+				    </span>
+				  </td>
+				</tr>
+                              </tbody>
+			    </table>
+
+			  </td>
+			  <td class="MessageBox_RightTrans">
+			    <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
+                              <tbody>
+				<tr>
+				  <td class="MessageBox_TopRight"></td>
+				</tr>
+				<tr>
+				  <td class="MessageBox_Right"></td>
+				</tr>
+                              </tbody>
+			    </table>
+			  </td>
+			</tr>
+			<tr>
+			  <td rowspan="2" class="MessageBox_BottomLeft">
+			  </td>
+			  <td class="MessageBox_BottomTrans MessageBox_bg">
+			  </td>
+			  <td rowspan="2" class="MessageBox_BottomRight">
+			  </td>
+			</tr>
+			<tr>
+			  <td class="MessageBox_Bottom">
+			  </td>
+			</tr>
+                      </tbody>
+                    </table>
+
+		  </td>
+		  <td class="MessageBox_RightMargin"></td>
+		</tr>
+		<tr class="MessageBox_BottomMargin">
+		  <td class="MessageBox_LeftMargin"></td>
+		  <td></td>
+                  <td class="MessageBox_RightMargin"></td>
+		</tr>
+              </tbody>
+            </table>
+            <!-- MessageBox END -->
+          </div>
+	</td>
+      </tr>
+    </table>
+    
+    <!-- Read only info -->
+    <table cellspacing="0" cellpadding="0" width="100%">
+      <tr>		
+	<td></td>
+	<td></td>
+      </tr>
+      <tr>
+        <td class="TableEdition_OneCell_width"></td>
+        <td class="TableEdition_OneCell_width"></td>
+        <td class="TableEdition_OneCell_width"></td>
+        <td class="TableEdition_OneCell_width"></td>
+        <td class="TableEdition_OneCell_width"></td>
+      </tr>
+      <tr>
+        <td class="TitleCell"><span name="lbl" id="lblGrandTotalAmt" class="LabelText">Total Gross Amount</span></td>
+        <td class="TextBox_ContentCell"><input class="readonly dojoValidateValid TextBox_OneCells_width number" type="text" name="inpInvoiceGrossAmt" value="" id="paramInvoiceGrossAmt" outputformat="euroEdition"></input></td>
+        <td class="TitleCell"><span class="LabelText" name="lbl" id="lblPendingAmount">Credit to be used</span></td>
+        <td class="TextBox_ContentCell"><input class="readonly dojoValidateValid TextBox_OneCell_width number" type="text" name="inpExpectedPayment" value="" id="paramPendingAmt" outputformat="euroEdition"></input></td>      
+        <td class="TitleCell"></td>
+      </tr>
+      <tr>
+              <td class="TitleCell"><span name="lbl" id="lblPaymentDate" class="LabelText">Payment Date</span></td>
+              <td class="TextBox_btn_ContentCell">
+                <table border="0" cellspacing="0" cellpadding="0" summary=""  style="padding-top: 0px;">
+                  <tr>
+                    <td class="TextBox_ContentCell">
+                      <table style="border: 0px none; border-collapse: collapse;">
+                        <tr><td style="padding-top: 0px;">
+                          <input type="text" id="paramPaymentDate" name="inpPaymentDate" onchange="validateDateTextBox(this.id); validateDate(this);logChanges(this);return true;" onblur="expandDateYear(this.id);" oncontextmenu="changeToEditingMode('oncontextmenu');" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown');" onkeyup="autoCompleteDate(this);" maxlength="10" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width" displayFormat="xx" saveFormat="yy">
+                        </td></tr>
+                      </table>
+                      <span id="paramPaymentDateinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                        <table class="TextBox_MsgContainer_table">
+                          <tbody><tr class="TextBox_MsgContainer_tr"><td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td></tr>
+                          <tr><td class="invalid" colspan="2"><div name="invalidText" id="paramPaymentDateinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td></tr>
+                        </tbody></table>
+                      </span>
+                      <span id="paramPaymentDatemissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                        <table class="TextBox_MsgContainer_table">
+                          <tbody><tr class="TextBox_MsgContainer_tr">
+                            <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
+                          </tr>
+                          <tr>
+                            <td class="missing" colspan="2"><div name="missingText" id="paramPaymentDatemissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
+                          </tr>
+                          </tbody></table>
+                      </span>
+                    </td>
+                    <td class="FieldButton_ContentCell">
+                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Calendar'; return true;" onblur="window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;" onclick="showCalendar('frmMain.inpPaymentDate', document.frmMain.inpPaymentDate.value, false);return false;">
+                        <table class="FieldButton"  onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='Show calendar';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;">
+                          <tr>
+                            <td class="FieldButton_bg">
+                              <img alt="Calendar" class="FieldButton_Icon FieldButton_Icon_Calendar" title="Calendar" src="../../../../../web/images/blank.gif" border="0"></img>
+                            </td>
+                          </tr>
+                        </table>
+                      </a>
+                    </td>
+                  </tr>
+                </table>
+              </td>
+              <td class="TitleCell"></td>
+              <td class="TitleCell"></td>
+              <td class="TitleCell"></td>
+         </tr>
+    </table>
+
+    <!-- Grid and Buttons -->
+    <table cellspacing="0" cellpadding="0" width="100%">
+      <!-- Grid -->
+      <tr>
+        <td>
+          <div class="Popup_ContentPane_Client" style="overflow: auto;" id="client_middle">
+            <table width="100%" cellspacing="0" cellpadding="0" class="Popup_Client_TablePopup">
+              <!-- Grid -->
+              <tr>	
+		<td>
+		  <table cellspacing="0" cellpadding="0" width="100%" class="DataGrid_Header_Table DataGrid_Body_Table" style="table-layout: auto;">
+                    <thead>
+                      <tr class="DataGrid_Body_Row">
+			<th class="DataGrid_Header_LineNoCell DataGrid_Body_Cell_CheckBox" width="25"> 
+                      <!--  <input type="checkbox" name="inpAllLines" onclick="markAll(document.frmMain.inpCreditPaymentId, this.checked);updateAll(true);return true;"/> -->    
+			</th>
+			<th class="DataGrid_Header_Cell" width="50">Credit Payment No</th>
+			<th class="DataGrid_Header_Cell" width="400">Description</th>
+			<th class="DataGrid_Header_Cell" width="70">Payment Date</th>
+			<th class="DataGrid_Header_Cell" width="70">Outstanding Amount</th>
+			<th class="DataGrid_Header_Cell" width="70">Amount</th>
+                      </tr>
+                    </thead>
+                    <tbody id="sectionGrid">
+                    </tbody>
+		  </table>
+		</td>
+              </tr>
+            </table>
+	  </div>
+	</td>
+      </tr>
+      
+      <!-- Buttons -->
+      <tr>
+	<td>
+          <div class="Popup_ContentPane_Client" style="overflow: auto; padding-bottom: 5px;" id="client_bottom">
+            <table cellspacing="0" cellpadding="0" class="Popup_Client_TableSelector">
+
+              <tr>
+		<td class="TableEdition_OneCell_width"></td>
+		<td class="TableEdition_OneCell_width"></td>
+		<td class="TableEdition_OneCell_width"></td>
+		<td class="TableEdition_OneCell_width"></td>
+		<td class="TableEdition_OneCell_width"></td>
+		<td class="TableEdition_OneCell_width"></td>
+              </tr>
+              <tr>
+		<td></td>
+		<td></td>
+		<td class="Button_RightAlign_ContentCell">
+                  <div>
+                    <button type="button" 
+			    id="buttonProcess"
+			    class="ButtonLink" 
+			    onclick="submitThisPage('USECREDITPAYMENTS');return false;"
+			    onfocus="buttonEvent('onfocus', this); window.status='Create'; return true;"
+			    onblur="buttonEvent('onblur', this);"
+			    onkeyup="buttonEvent('onkeyup', this);"
+			    onkeydown="buttonEvent('onkeydown', this);"
+			    onkeypress="buttonEvent('onkeypress', this);"
+			    onmouseup="buttonEvent('onmouseup', this);"
+			    onmousedown="buttonEvent('onmousedown', this);"
+			    onmouseover="buttonEvent('onmouseover', this); window.status='Create'; return true;"
+			    onmouseout="buttonEvent('onmouseout', this);">
+                      <table class="Button">
+			<tr>
+                          <td class="Button_left"><img class="Button_Icon Button_Icon_ok" alt="Process" title="Process" src="../../../../../web/images/blank.gif" border="0" /></td>
+                          <td class="Button_text Button_width">Process</td>
+                          <td class="Button_right"></td>
+			</tr>
+                      </table>
+                    </button>
+                  </div>
+		</td>
+		<td class="Button_LeftAlign_ContentCell">
+                  <div>
+                    <button type="button" 
+			    id="buttonCancel" 
+			    class="ButtonLink" 
+			    onclick="submitThisPage('CANCEL_USECREDITPAYMENTS');return false;"
+			    onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;"
+			    onblur="buttonEvent('onblur', this);"
+			    onkeyup="buttonEvent('onkeyup', this);"
+			    onkeydown="buttonEvent('onkeydown', this);"
+			    onkeypress="buttonEvent('onkeypress', this);"
+			    onmouseup="buttonEvent('onmouseup', this);"
+			    onmousedown="buttonEvent('onmousedown', this);"
+			    onmouseover="buttonEvent('onmouseover', this); window.status='Cancel'; return true;"
+			    onmouseout="buttonEvent('onmouseout', this);">
+                      <table class="Button">
+			<tr>
+                          <td class="Button_left"><img class="Button_Icon Button_Icon_cancel" alt="Cancel" title="Cancel" src="../../../../../web/images/blank.gif" border="0" /></td>
+                          <td class="Button_text Button_width">Cancel</td>
+                          <td class="Button_right"></td>
+			</tr>
+                      </table>
+                    </button>
+                  </div>
+		</td>
+		<td></td>
+		<td></td>
+              </tr>
+            </table>
+          </div>
+	</td>
+      </tr>
+    </table>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreditPaymentGrid.xml	Mon Nov 07 14:22:37 2011 +0100
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2011 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<REPORT>
+    <template id="class" file="CreditPaymentGrid.html"/>
+    <PARAMETER id="paramLanguage" name="language" default=""/>
+    <PARAMETER id="paramCSS" name="css" attribute="href" replace="Default"/>
+    <PARAMETER id="messageBoxID" name="messageType" attribute="class" replace="yy" default="HIDDEN"/>
+    <PARAMETER id="messageBoxIDTitle" name="messageTitle" default=""/>
+    <PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>
+    <PARAMETER id="fieldCalendar" name="calendar" attribute="src" replace="es" default="en"/>
+    
+    <PARAMETER id="key" name="key" default="" attribute="value"/>
+    <PARAMETER id="window" name="window" default="" attribute="value"/>
+    <PARAMETER id="tab" name="tab" default="" attribute="value"/>
+    <PARAMETER id="adOrgId" name="adOrgId" default="" attribute="value"/>
+    <PARAMETER id="processHelp" name="processDescription" default=""/>
+    <PARAMETER id="paramDirectory" name="directory" default=""/>
+    
+    <PARAMETER id="buttonOK" name="processId" default="" attribute="onclick" replace="xx"/>
+    <PARAMETER id="buttonOk" name="ok" default="" attribute="alt" replace="xx"/>
+    <PARAMETER id="buttonOk" name="ok" default="" attribute="title" replace="xx"/>
+    <PARAMETER id="buttonCancel" name="cancel" default="" attribute="alt" replace="xx"/> 
+    <PARAMETER id="buttonCancel" name="cancel" default="" attribute="title" replace="xx"/>  
+    
+    <PARAMETER id="paramPaymentDate" name="paymentDate" attribute="value"/>
+    <PARAMETER id="paramPaymentDate" name="dateDisplayFormat" attribute="displayformat" replace="xx"/>
+    <PARAMETER id="paramPaymentDate" name="dateDisplayFormat" attribute="saveformat" replace="yy"/>   
+
+    <PARAMETER id="paramInvoiceGrossAmt" name="invoiceGrossAmt" attribute="value" format="euroEdition"/>
+    <PARAMETER id="paramPendingAmt" name="pendingAmt" attribute="value" format="euroEdition"/>
+    
+    <DISCARD id="discard"/>
+</REPORT>
--- a/src/org/openbravo/erpCommon/security/Login.html	Sun Nov 06 12:28:23 2011 +0100
+++ b/src/org/openbravo/erpCommon/security/Login.html	Mon Nov 07 14:22:37 2011 +0100
@@ -388,7 +388,7 @@
     }
     catch (e) { }
 
-    if ((!revisionControl('11668')) || (isOpsInstance() != isOpsInstanceCached())) {
+    if ((!revisionControl('11669')) || (isOpsInstance() != isOpsInstanceCached())) {
       maskLoginWindow(cacheMsg);
       setLoginMessage('Warning', '', cacheMsg);
     }
--- a/src/org/openbravo/erpCommon/security/Login_F1.html	Sun Nov 06 12:28:23 2011 +0100
+++ b/src/org/openbravo/erpCommon/security/Login_F1.html	Mon Nov 07 14:22:37 2011 +0100
@@ -126,7 +126,7 @@
       clearForm();
     } catch (e) {}
     setWindowElementFocus('firstElement');
-    if ((!revisionControl('11668')) || (isOpsInstance() != isOpsInstanceCached())) {
+    if ((!revisionControl('11669')) || (isOpsInstance() != isOpsInstanceCached())) {
       alert(cacheMsg);
     }
 
--- a/web/js/callOut.js	Sun Nov 06 12:28:23 2011 +0100
+++ b/web/js/callOut.js	Mon Nov 07 14:22:37 2011 +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) 2001-2008 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -32,6 +32,10 @@
 function setgWaitingCallOut(state, frameName) {
   if (frameName==null || frameName=="") frameName=frameDefault;
   objFrame = eval("parent." + frameName);
+  if (!objFrame) {
+    // working in 3.0 modal window
+    objFrame = parent;
+  }
   objFrame.setGWaitingCallOut(state);
 }
 
@@ -46,6 +50,13 @@
   if (arrResponse==null && (calloutName==null || calloutName=="")) return false;
   if (frameName==null || frameName=="") frameName=frameDefault;
   objFrame = eval("parent." + frameName);
+  if (!objFrame) {
+    // working in 3.0 modal window
+    objFrame = parent;
+    if (!objFrame.fillElementsFromArray) {
+      return;
+    }
+  }
   if (objFrame) {
     objFrame.fillElementsFromArray(arrResponse, calloutName, formName);
     try {
--- a/web/js/utils.js	Sun Nov 06 12:28:23 2011 +0100
+++ b/web/js/utils.js	Mon Nov 07 14:22:37 2011 +0100
@@ -95,7 +95,7 @@
 * Return a number that would be checked at the Login screen to know if the file is cached with the correct version
 */
 function getCurrentRevision() {
-  var number = '11668';
+  var number = '11669';
   return number;
 }