diff --git a/src/org/openbravo/agingbalance/ad_reports/AgingDao.java b/src/org/openbravo/agingbalance/ad_reports/AgingDao.java
--- a/src/org/openbravo/agingbalance/ad_reports/AgingDao.java
+++ b/src/org/openbravo/agingbalance/ad_reports/AgingDao.java
@@ -44,6 +44,7 @@
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.data.FieldProvider;
+import org.openbravo.database.ConnectionProvider;
 import org.openbravo.erpCommon.utility.FieldProviderFactory;
 import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.erpCommon.utility.Utility;
@@ -51,7 +52,6 @@
 import org.openbravo.model.common.currency.Currency;
 import org.openbravo.model.common.enterprise.Organization;
 import org.openbravo.model.financialmgmt.accounting.coa.AcctSchema;
-import org.openbravo.service.db.DalConnectionProvider;
 
 public class AgingDao {
   private static Logger log4j = Logger.getLogger(AgingDao.class);
@@ -69,11 +69,11 @@
    * objects containing the information for the report
    * 
    */
-  public FieldProvider[] getOpenReceivablesAgingSchedule(String strcBpartnerId,
-      String strAccSchema, Date currentDate, String strcolumn1, String strcolumn2,
-      String strcolumn3, String strcolumn4, String strOrg, Set<String> organizations,
-      String recOrPay, boolean showDoubtfulDebt, boolean excludeVoids) throws IOException,
-      ServletException {
+  public FieldProvider[] getOpenReceivablesAgingSchedule(ConnectionProvider connectionProvider,
+      String strcBpartnerId, String strAccSchema, Date currentDate, String strcolumn1,
+      String strcolumn2, String strcolumn3, String strcolumn4, String strOrg,
+      Set<String> organizations, String recOrPay, boolean showDoubtfulDebt, boolean excludeVoids)
+      throws IOException, ServletException {
 
     // Initialization of some variables
     List<String> paidStatus = FIN_Utility.getListPaymentConfirmed();
@@ -101,10 +101,10 @@
     long init = System.currentTimeMillis();
     try {
       // Amounts coming from normal PSD (non credit)
-      dataSR = AgingDaoData.select(new DalConnectionProvider(false), showDoubtfulDebt ? "Y" : "N",
-          OBDateUtils.formatDate(currentDate), convCurrency.getId(), OBDateUtils
-              .formatDate(convertToDate(currentDate, strcolumn1)), OBDateUtils
-              .formatDate(convertToDate(currentDate, strcolumn2)), OBDateUtils
+      dataSR = AgingDaoData.select(connectionProvider, showDoubtfulDebt ? "Y" : "N", OBDateUtils
+          .formatDate(currentDate), convCurrency.getId(), OBDateUtils.formatDate(convertToDate(
+          currentDate, strcolumn1)),
+          OBDateUtils.formatDate(convertToDate(currentDate, strcolumn2)), OBDateUtils
               .formatDate(convertToDate(currentDate, strcolumn3)), OBDateUtils
               .formatDate(convertToDate(currentDate, strcolumn4)), Utility
               .getInStrSet(organizations), strcBpartnerId, StringUtils.equals(recOrPay,
@@ -142,10 +142,10 @@
       // Credits: In this section the Credits are going to be processed.
       init = System.currentTimeMillis();
       // Query for credit payments
-      dataCreditSR = AgingDaoData.selectCredit(new DalConnectionProvider(false), convCurrency
-          .getId(), Utility.getInStrSet(organizations), Utility.getInStrSet(new HashSet<String>(
-          paidStatus)), OBDateUtils.formatDate(currentDate), StringUtils.equals(recOrPay,
-          "RECEIVABLES") ? "Y" : "N", strcBpartnerId);
+      dataCreditSR = AgingDaoData.selectCredit(connectionProvider, convCurrency.getId(), Utility
+          .getInStrSet(organizations), Utility.getInStrSet(new HashSet<String>(paidStatus)),
+          OBDateUtils.formatDate(currentDate), StringUtils.equals(recOrPay, "RECEIVABLES") ? "Y"
+              : "N", strcBpartnerId);
       log4j.debug("Credit Query: " + (System.currentTimeMillis() - init));
       init = System.currentTimeMillis();
       i = 0;
@@ -199,11 +199,12 @@
    * This method returns an array of fieldProviders with the necessary information to print the
    * Aging Schedule Details report.
    */
-  public FieldProvider[] getOpenReceivablesAgingScheduleDetails(List<BusinessPartner> bPartners,
-      String strAccSchema, Date currentDate, SimpleDateFormat dateFormat, Currency convCurrency,
-      String strOrg, Set<String> organizations, String recOrPay, String strcolumn1,
-      String strcolumn2, String strcolumn3, String strcolumn4, String strcBpartnerId,
-      boolean showDoubtfulDebt, Boolean excludeVoid) throws IOException, ServletException {
+  public FieldProvider[] getOpenReceivablesAgingScheduleDetails(
+      ConnectionProvider connectionProvider, List<BusinessPartner> bPartners, String strAccSchema,
+      Date currentDate, SimpleDateFormat dateFormat, Currency convCurrency, String strOrg,
+      Set<String> organizations, String recOrPay, String strcolumn1, String strcolumn2,
+      String strcolumn3, String strcolumn4, String strcBpartnerId, boolean showDoubtfulDebt,
+      Boolean excludeVoid) throws IOException, ServletException {
 
     List<HashMap<String, String>> hashMapList = new ArrayList<HashMap<String, String>>();
     FieldProvider[] data = null;
@@ -214,7 +215,7 @@
     long init = System.currentTimeMillis();
     try {
       // Amounts coming from normal PSD (non credit)
-      dataSR = AgingDaoData.selectDetail(new DalConnectionProvider(false), convCurrency.getId(),
+      dataSR = AgingDaoData.selectDetail(connectionProvider, convCurrency.getId(),
           showDoubtfulDebt ? "Y" : "N", OBDateUtils.formatDate(currentDate), OBDateUtils
               .formatDate(convertToDate(currentDate, strcolumn1)), OBDateUtils
               .formatDate(convertToDate(currentDate, strcolumn2)), OBDateUtils
@@ -256,10 +257,10 @@
 
       final List<String> paidStatus = FIN_Utility.getListPaymentConfirmed();
       // Query for credit payments
-      dataCreditSR = AgingDaoData.selectCredit(new DalConnectionProvider(false), convCurrency
-          .getId(), Utility.getInStrSet(organizations), Utility.getInStrSet(new HashSet<String>(
-          paidStatus)), OBDateUtils.formatDate(currentDate), StringUtils.equals(recOrPay,
-          "RECEIVABLES") ? "Y" : "N", strcBpartnerId);
+      dataCreditSR = AgingDaoData.selectCredit(connectionProvider, convCurrency.getId(), Utility
+          .getInStrSet(organizations), Utility.getInStrSet(new HashSet<String>(paidStatus)),
+          OBDateUtils.formatDate(currentDate), StringUtils.equals(recOrPay, "RECEIVABLES") ? "Y"
+              : "N", strcBpartnerId);
       log4j.debug("Credit Query: " + (System.currentTimeMillis() - init));
       init = System.currentTimeMillis();
       i = 0;
diff --git a/src/org/openbravo/agingbalance/ad_reports/AgingProcess.java b/src/org/openbravo/agingbalance/ad_reports/AgingProcess.java
--- a/src/org/openbravo/agingbalance/ad_reports/AgingProcess.java
+++ b/src/org/openbravo/agingbalance/ad_reports/AgingProcess.java
@@ -240,8 +240,8 @@
       boolean excludeVoid = "false".equals(strVoid);
 
       // Get the Data
-      FieldProvider[] data = dao.getOpenReceivablesAgingSchedule(strcBpartnerId, strAccSchema,
-          currentDate, strcolumn1, strcolumn2, strcolumn3, strcolumn4, strOrgTrx,
+      FieldProvider[] data = dao.getOpenReceivablesAgingSchedule(this, strcBpartnerId,
+          strAccSchema, currentDate, strcolumn1, strcolumn2, strcolumn3, strcolumn4, strOrgTrx,
           new OrganizationStructureProvider().getChildTree(strOrgTrx, true), recOrPay,
           showDoubtful, excludeVoid);
 
@@ -388,8 +388,8 @@
       }
 
       // Get the data
-      FieldProvider[] data = dao.getOpenReceivablesAgingScheduleDetails(bPartners, strAccSchema,
-          currentDate, dateFormat, convCurrency, strOrg,
+      FieldProvider[] data = dao.getOpenReceivablesAgingScheduleDetails(this, bPartners,
+          strAccSchema, currentDate, dateFormat, convCurrency, strOrg,
           new OrganizationStructureProvider().getChildTree(strOrg, true), recOrPay, strcolumn1,
           strcolumn2, strcolumn3, strcolumn4, strcBpartnerId, showDoubtful, excludeVoid);
 
