You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2015/01/05 09:50:36 UTC

svn commit: r1649482 [2/26] - in /ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23: ./ applications/accounting/src/org/ofbiz/accounting/invoice/ applications/accounting/src/org/ofbiz/accounting/payment/ applications/accounting/src/org/ofbiz/acc...

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java Mon Jan  5 08:50:30 2015
@@ -865,7 +865,7 @@ public class CCPaymentServices {
         Element instructionsElement = UtilXml.addChildElement(engineDocElement, "Instructions", requestDocument);
 
         String pipeline = "PaymentNoFraud";
-        if (UtilProperties.propertyValueEqualsIgnoreCase(paymentConfig, "payment.clearcommerce.enableFraudShield", "Y")) {
+        if (EntityUtilProperties.propertyValueEqualsIgnoreCase(paymentConfig, "payment.clearcommerce.enableFraudShield", "Y", delegator)) {
             pipeline = "Payment";
         }
         UtilXml.addChildElementValue(instructionsElement, "Pipeline", pipeline, requestDocument);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/admin/ListInvoiceItemTypesGlAccount.groovy Mon Jan  5 08:50:30 2015
@@ -30,7 +30,7 @@ invItemTypePrefix += "_%";
 
 organizationPartyId = parameters.organizationPartyId;
 exprBldr = new EntityConditionBuilder();
-invoiceItemTypes = delegator.findList("InvoiceItemType", exprBldr.LIKE(invoiceItemTypeId: invItemTypePrefix), null, null, null, false);
+invoiceItemTypes = from('InvoiceItemType').where(exprBldr.LIKE(invoiceItemTypeId: invItemTypePrefix)).queryList();
 
 context.invoiceItemTypes = invoiceItemTypes.collect { invoiceItemType ->
     defaultAccount = true

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/chartofaccounts/TaxAuthorityGlAccounts.groovy Mon Jan  5 08:50:30 2015
@@ -20,7 +20,7 @@
 import org.ofbiz.base.util.UtilMisc;
 import javolution.util.FastList;
 
-taxAuthorities = delegator.findList("TaxAuthority", null, null, ["taxAuthGeoId", "taxAuthPartyId"], null, false);
+taxAuthorities = from('TaxAuthority').orderBy("taxAuthGeoId", "taxAuthPartyId").queryList();
 
 context.taxAuthorityHavingNoGlAccountList = taxAuthorities.findAll { taxAuthority ->
     !taxAuthority.getRelated('TaxAuthorityGlAccount', [organizationPartyId : organizationPartyId], null, false)

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy Mon Jan  5 08:50:30 2015
@@ -38,7 +38,7 @@ if (fixedAsset) {
             context.geoChart = geoChart;
         }
         if (latestGeoPoint.elevationUomId) {
-            elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
+            elevationUom = from('Uom').where('uomId', atestGeoPoint.elevationUomId).queryOne()
             context.elevationUomAbbr = elevationUom.abbreviation;
         }
     }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/EditInvoice.groovy Mon Jan  5 08:50:30 2015
@@ -35,7 +35,7 @@ import javolution.util.FastMap;
 
 invoiceId = parameters.get("invoiceId");
 
-invoice = delegator.findOne("Invoice", [invoiceId : invoiceId], false);
+invoice = from('Invoice').where('invoiceId', invoiceId).queryOne();
 context.invoice = invoice;
 
 currency = parameters.currency;        // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency
@@ -77,13 +77,17 @@ if (invoice) {
         // also create a map with tax grand total amount by VAT tax: it is also required in invoices by UE
         taxRate = invoiceItem.getRelatedOne("TaxAuthorityRateProduct", false);
         if (taxRate && "VAT_TAX".equals(taxRate.taxAuthorityRateTypeId)) {
-            taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : billToParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId], null, false), invoice.invoiceDate);
-            taxInfo = EntityUtil.getFirst(taxInfos);
+            taxInfo = from("PartyTaxAuthInfo")
+                .where('partyId', billToParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId)
+                .filterByDate(invoice.invoiceDate)
+                .queryFirst();
             if (taxInfo) {
                 context.billToPartyTaxId = taxInfo.partyTaxId;
             }
-            taxInfos = EntityUtil.filterByDate(delegator.findByAnd("PartyTaxAuthInfo", [partyId : sendingParty.partyId, taxAuthGeoId : taxRate.taxAuthGeoId, taxAuthPartyId : taxRate.taxAuthPartyId], null, false), invoice.invoiceDate);
-            taxInfo = EntityUtil.getFirst(taxInfos);
+            taxInfo = from("PartyTaxAuthInfo")
+                .where('partyId', sendingParty.partyId, 'taxAuthGeoId', taxRate.taxAuthGeoId, 'taxAuthPartyId', taxRate.taxAuthPartyId)
+                .filterByDate(invoice.invoiceDate)
+                .queryFirst();
             if (taxInfo) {
                 context.sendingPartyTaxId = taxInfo.partyTaxId;
             }
@@ -135,10 +139,10 @@ if (invoice) {
     terms = invoice.getRelated("InvoiceTerm", null, null, false);
     context.terms = terms;
 
-    paymentAppls = delegator.findByAnd("PaymentApplication", [invoiceId : invoiceId], null, false);
+    paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList();
     context.payments = paymentAppls;
 
-    orderItemBillings = delegator.findByAnd("OrderItemBilling", [invoiceId : invoiceId], ['orderId'], false);
+    orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy('orderId').queryList();
     orders = new LinkedHashSet();
     orderItemBillings.each { orderIb ->
         orders.add(orderIb.orderId);
@@ -150,7 +154,7 @@ if (invoice) {
 
     edit = parameters.editInvoice;
     if ("true".equalsIgnoreCase(edit)) {
-        invoiceItemTypes = delegator.findList("InvoiceItemType", null, null, null, null, false);
+        invoiceItemTypes = from("InvoiceItemType").queryList();
         context.invoiceItemTypes = invoiceItemTypes;
         context.editInvoice = true;
     }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/GetAccountOrganizationAndClass.groovy Mon Jan  5 08:50:30 2015
@@ -40,8 +40,8 @@ if ("SALES_INVOICE".equals(invoice.invoi
         EQUALS(invoiceItemTypeId: "INV_PROD_ITEM")
         EQUALS(parentTypeId: "INV_PROD_ITEM")
     }
-    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
-    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyIdFrom], null, false);
+    invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
+    glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyIdFrom).queryList();
 } else if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId)) {
     itemTypesCond = exprBldr.OR() {
         EQUALS(invoiceItemTypeId: "PINVOICE_ADJ")
@@ -51,8 +51,8 @@ if ("SALES_INVOICE".equals(invoice.invoi
         EQUALS(invoiceItemTypeId: "PINV_PROD_ITEM")
         EQUALS(parentTypeId: "PINV_PROD_ITEM")
     }
-    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
-    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false);
+    invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
+    glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList();
 } else if ("PAYROL_INVOICE".equals(invoice.invoiceTypeId)) {
     itemTypesCond = exprBldr.OR() {
         EQUALS(invoiceItemTypeId: "PAYROL_EARN_HOURS")
@@ -62,8 +62,8 @@ if ("SALES_INVOICE".equals(invoice.invoi
         EQUALS(invoiceItemTypeId: "PAYROL_TAXES")
         EQUALS(parentTypeId: "PAYROL_TAXES")
     }
-    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
-    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false);
+    invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
+    glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList();
 } else if ("COMMISSION_INVOICE".equals(invoice.invoiceTypeId)) {
     itemTypesCond = exprBldr.OR() {
         EQUALS(invoiceItemTypeId: "COMM_INV_ITEM")
@@ -71,10 +71,10 @@ if ("SALES_INVOICE".equals(invoice.invoi
         EQUALS(invoiceItemTypeId: "COMM_INV_ADJ")
         EQUALS(parentTypeId: "COMM_INV_ADJ")
     }
-    invoiceItemTypes = delegator.findList("InvoiceItemType", itemTypesCond, null, ["parentTypeId", "invoiceItemTypeId"], null, false);
-    glAccountOrganizationAndClassList = delegator.findByAnd("GlAccountOrganizationAndClass", [organizationPartyId : invoice.partyId], null, false);
+    invoiceItemTypes = from("InvoiceItemType").where(itemTypesCond).orderBy(["parentTypeId", "invoiceItemTypeId"]).queryList();
+    glAccountOrganizationAndClassList = from("GlAccountOrganizationAndClass").where('organizationPartyId', invoice.partyId).queryList();
 } else {
-    map = delegator.findByAnd("InvoiceItemTypeMap", [invoiceTypeId : invoice.invoiceTypeId], null, true);
+    map = from("InvoiceItemTypeMap").where('invoiceTypeId', invoice.invoiceTypeId).cache(true).queryList();
     invoiceItemTypes = EntityUtil.getRelated("InvoiceItemType", map, null, false);
 }
 context.invoiceItemTypes = invoiceItemTypes;

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/InvoiceReport.groovy Mon Jan  5 08:50:30 2015
@@ -42,10 +42,10 @@ if (invoiceTypeId) {
     }
     expr = exprBldr.AND([expr, invoiceStatusesCondition]);
 
-    PastDueInvoices = delegator.findList("Invoice", expr, null, ["dueDate DESC"], null, false);
+    PastDueInvoices = from("Invoice").where(expr).orderBy("dueDate DESC").queryList();
     if (PastDueInvoices) {
         invoiceIds = PastDueInvoices.invoiceId;
-        totalAmount = dispatcher.runSync("getInvoiceRunningTotal", [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]);
+        totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId]);
         if (totalAmount) {
             context.PastDueInvoicestotalAmount = totalAmount.invoiceRunningTotal;
         }
@@ -56,12 +56,10 @@ if (invoiceTypeId) {
         EQUALS(invoiceTypeId: invoiceTypeId)
         GREATER_THAN_EQUAL_TO(dueDate: UtilDateTime.nowTimestamp())
     }
-    EntityFindOptions findOptions = new EntityFindOptions();
-    findOptions.setMaxRows(10);
-    InvoicesDueSoon = delegator.findList("Invoice", invoicesCond, null, ["dueDate ASC"], findOptions, false);
+    InvoicesDueSoon = from("Invoice").where(invoicesCond).orderBy("dueDate ASC").maxRows(10).queryList();
     if (InvoicesDueSoon) {
         invoiceIds = InvoicesDueSoon.invoiceId;
-        totalAmount = dispatcher.runSync("getInvoiceRunningTotal", [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId, userLogin: userLogin]);
+        totalAmount = runService('getInvoiceRunningTotal', [invoiceIds: invoiceIds, organizationPartyId: organizationPartyId]);
         if (totalAmount) {
             context.InvoicesDueSoonTotalAmount = totalAmount.invoiceRunningTotal;
         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy Mon Jan  5 08:50:30 2015
@@ -32,7 +32,7 @@ import org.ofbiz.entity.condition.Entity
 import java.math.*;
 
 invoiceId = parameters.invoiceId;
-invoice = delegator.findOne("Invoice", [invoiceId : invoiceId], false);
+invoice = from("Invoice").where(invoiceId : invoiceId).queryOne();
 
 decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
 rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
@@ -52,9 +52,9 @@ topCondActual = exprBldr.AND(preCurrency
     EQUALS(actualCurrencyUomId: invoice.currencyUomId)
 }
 
-payments = delegator.findList("Payment", topCond, null, ["effectiveDate"], null, false);
+payments = from("Payment").where(topCond).orderBy("effectiveDate").queryList();
 context.payments = getPayments(payments, false);
-payments = delegator.findList("Payment", topCondActual, null, ["effectiveDate"], null, false);
+payments = from("Payment").where(topCondActual).orderBy("effectiveDate").queryList();
 context.paymentsActualCurrency = getPayments(payments, true);
 
 List getPayments(List payments, boolean actual) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/PrintInvoices.groovy Mon Jan  5 08:50:30 2015
@@ -25,7 +25,7 @@ import org.ofbiz.entity.condition.Entity
 invoiceDetailList = [];
 invoiceIds.each { invoiceId ->
     invoicesMap = [:];
-    invoice = delegator.findOne("Invoice", [invoiceId : invoiceId], false);
+    invoice = from("Invoice").where('invoiceId', invoiceId).queryOne();
     invoicesMap.invoice = invoice;
     
     currency = parameters.currency;  // allow the display of the invoice in the original currency, the default is to display the invoice in the default currency
@@ -98,10 +98,10 @@ invoiceIds.each { invoiceId ->
         terms = invoice.getRelated("InvoiceTerm", null, null, false);
         invoicesMap.terms = terms;
     
-        paymentAppls = delegator.findList("PaymentApplication", EntityCondition.makeCondition([invoiceId : invoiceId]), null, null, null, false);
+        paymentAppls = from("PaymentApplication").where('invoiceId', invoiceId).queryList();
         invoicesMap.payments = paymentAppls;
     
-        orderItemBillings = delegator.findList("OrderItemBilling", EntityCondition.makeCondition([invoiceId : invoiceId]), null, ['orderId'], null, false);
+        orderItemBillings = from("OrderItemBilling").where('invoiceId', invoiceId).orderBy("orderId").queryList();
         orders = new LinkedHashSet();
         orderItemBillings.each { orderIb ->
             orders.add(orderIb.orderId);
@@ -113,7 +113,7 @@ invoiceIds.each { invoiceId ->
     
         edit = parameters.editInvoice;
         if ("true".equalsIgnoreCase(edit)) {
-            invoiceItemTypes = delegator.findList("InvoiceItemType", null, null, null, null, false);
+            invoiceItemTypes = from("InvoiceItemType").queryList();
             invoicesMap.invoiceItemTypes = invoiceItemTypes;
             invoicesMap.editInvoice = true;
         }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/order/BillingAccountOrders.groovy Mon Jan  5 08:50:30 2015
@@ -23,11 +23,11 @@ import javolution.util.FastMap;
 
 if (billingAccountId) {
     orderPaymentPreferencesList = [];
-    orderList = delegator.findByAnd("OrderHeader", [billingAccountId : billingAccountId], null, false);
+    orderList = from("OrderHeader").where('billingAccountId', billingAccountId).queryList();
     if (orderList) {
         orderList.each { orderHeader ->
             orderId = orderHeader.orderId;
-            orderBillingAcc = EntityUtil.getFirst(delegator.findByAnd("OrderHeaderAndPaymentPref", [orderId : orderId], null, false));
+            orderBillingAcc = from("OrderHeaderAndPaymentPref").where("orderId", orderId).queryFirst();
             orderBillingAccMap = FastMap.newInstance();
             if (orderBillingAcc.paymentMethodTypeId.equals("EXT_BILLACT") && orderBillingAcc.paymentStatusId.equals("PAYMENT_NOT_RECEIVED")) {
                 orderBillingAccMap.putAll(orderBillingAcc);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/BillingAccounts.groovy Mon Jan  5 08:50:30 2015
@@ -24,7 +24,7 @@ partyId = parameters.partyId;
 currencyUomId = null;
 billingAccounts = [];
 if (partyId) {
-    billingAccountAndRoles = delegator.findByAnd("BillingAccountAndRole", [partyId : partyId], null, false);
+    billingAccountAndRoles = from("BillingAccountAndRole").where('partyId', partyId).queryList()
     if (billingAccountAndRoles) currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId;
     if (currencyUomId) billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher);
 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/DepositWithdrawPayments.groovy Mon Jan  5 08:50:30 2015
@@ -25,9 +25,7 @@ import org.ofbiz.entity.condition.Entity
 if ("Y".equals(parameters.noConditionFind)) {
     List exprListForParameters = [];
     
-    finAcctCond = EntityCondition.makeCondition([EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId),
-                                                 EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "DIVISION")], EntityOperator.AND);
-    finAccountRoles = EntityUtil.filterByDate(delegator.findList("FinAccountRole", finAcctCond, null, null, null, false));
+    finAccountRoles = from("FinAccountRole").where("finAccountId", finAccountId, "roleTypeId", "DIVISION").filterByDate().queryList();
     finAccountPartyIds = EntityUtil.getFieldListFromEntityList(finAccountRoles, "partyId", true);
     finAccountPartyIds.add(organizationPartyId);
     partyCond = EntityCondition.makeCondition([EntityCondition.makeCondition("partyIdTo", EntityOperator.IN, finAccountPartyIds),
@@ -50,12 +48,12 @@ if ("Y".equals(parameters.noConditionFin
     exprListForParameters.add(EntityCondition.makeCondition("finAccountTransId", EntityOperator.EQUALS, null));
     paramCond = EntityCondition.makeCondition(exprListForParameters, EntityOperator.AND);
     combinedPaymentCond = EntityCondition.makeCondition([partyCond, statusCond, paramCond], EntityOperator.AND);
-    payments = delegator.findList("PaymentAndTypePartyNameView", combinedPaymentCond, null, null, null, false);
+    payments = from("PaymentAndTypePartyNameView").where(combinedPaymentCond).queryList();
     paymentListWithCreditCard = [];
     paymentListWithoutCreditCard = [];
     payments.each { payment ->
         if (cardType && payment.paymentMethodId) {
-            creditCard = delegator.findOne("CreditCard", [paymentMethodId : payment.paymentMethodId], false);
+            creditCard = from("CreditCard").where('paymentMethodId', payment.paymentMethodId).queryOne();
             if (creditCard.cardType == cardType) {
                 paymentListWithCreditCard.add(payment);
             }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy Mon Jan  5 08:50:30 2015
@@ -31,7 +31,7 @@ import org.ofbiz.entity.condition.Entity
 import java.math.*;
 
 paymentId = parameters.paymentId;
-payment = delegator.findOne("Payment", [paymentId : paymentId], false);
+payment = from("Payment").where("paymentId", paymentId).queryOne();
 
 decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
 rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
@@ -51,13 +51,20 @@ actualCurrCond = EntityCondition.makeCon
 
 topCond = EntityCondition.makeCondition([partyCond, statusCond, currCond], EntityOperator.AND);
 topCondActual = EntityCondition.makeCondition([partyCond, statusCond, actualCurrCond], EntityOperator.AND);
-fields = new HashSet(["invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate"]);
 
 //retrieve invoices for the related parties which have not been (fully) applied yet and which have the same currency as the payment
-invoices = delegator.findList("Invoice", topCond, fields, ["invoiceDate"], null, false);
+invoices = select("invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate")
+                .from("Invoice")
+                .where(topCond)
+                .orderBy("invoiceDate")
+                .queryList();
 context.invoices = getInvoices(invoices, false);
 //retrieve invoices for the related parties which have not been (fully) applied yet and which have the same originalCurrency as the payment
-invoices = delegator.findList("Invoice", topCondActual, fields, ["invoiceDate"], null, false);
+invoices = select("invoiceId", "invoiceTypeId", "currencyUomId", "description", "invoiceDate")
+                .from("Invoice")
+                .where(topCondActual)
+                .orderBy("invoiceDate")
+                .queryList();
 context.invoicesOtherCurrency = getInvoices(invoices, true);
 
 List getInvoices(List invoices, boolean actual) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedPayments.groovy Mon Jan  5 08:50:30 2015
@@ -34,7 +34,7 @@ import org.ofbiz.entity.model.*;
 import java.text.NumberFormat;
 
 basePaymentId = parameters.paymentId;
-basePayment = delegator.findOne("Payment", [paymentId : basePaymentId], false);
+basePayment = from("Payment").where("paymentId", basePaymentId).queryOne();
 
 decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
 rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
@@ -62,7 +62,7 @@ exprList.add(orCond);
 
 topCond = EntityCondition.makeCondition(exprList, EntityOperator.AND);
 
-payments = delegator.findList("Payment", topCond, null, ["effectiveDate"], null, false);
+payments = from("Payment").where(topCond).orderBy("effectiveDate").queryList()
 
 if (payments)    {
     basePaymentApplied = PaymentWorker.getPaymentApplied(basePayment);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/ManualTx.groovy Mon Jan  5 08:50:30 2015
@@ -20,18 +20,18 @@
 import org.ofbiz.base.util.*;
 
 // stores
-productStores = delegator.findList("ProductStore", null, null, ["storeName"], null, true);
+productStores = from("ProductStore").orderBy("storeName").cache(true).queryList();
 context.productStores = productStores;
 
 // current store
 productStoreId = parameters.productStoreId;
 if (productStoreId) {
-    productStore = delegator.findOne("ProductStore", [productStoreId : productStoreId], false);
+    productStore = from("ProductStore").where("productStoreId", productStoreId).queryOne();
     context.currentStore = productStore;
 }
 
 // payment settings
-paymentSettings = delegator.findByAnd("Enumeration", [enumTypeId : "PRDS_PAYSVC"], ["sequenceId"], false);
+paymentSettings = from("Enumeration").where("enumTypeId", "PRDS_PAYSVC").orderBy("sequenceId").queryList();
 context.paymentSettings = paymentSettings;
 
 // payment method (for auto-fill)
@@ -46,12 +46,12 @@ context.paymentMethodTypeId = paymentMet
 txType = parameters.transactionType;
 context.txType = txType;
 if (txType) {
-    currentTx = delegator.findOne("Enumeration", [enumId : txType], false);
+    currentTx = from("Enumeration").where("enumId", txType).queryOne();
     context.currentTx = currentTx;
 }
 
 if (paymentMethodId) {
-    paymentMethod = delegator.findOne("PaymentMethod", [paymentMethodId : paymentMethodId], false);
+    paymentMethod = from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne();
     if (paymentMethod) {
         // payment method type
         paymentMethodTypeId = paymentMethod.paymentMethodTypeId;
@@ -82,7 +82,7 @@ if (paymentMethodId) {
 }
 
 if (paymentMethodTypeId) {
-    paymentMethodType = delegator.findOne("PaymentMethodType", [paymentMethodTypeId : paymentMethodTypeId], false);
+    paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne();
     context.paymentMethodType = paymentMethodType;
     context.paymentMethodTypeId = paymentMethodTypeId;
 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/payment/PrintChecks.groovy Mon Jan  5 08:50:30 2015
@@ -45,7 +45,7 @@ if (!security.hasEntityPermission("ACCOU
 // in the case of a single payment, the paymentId will be supplied
 paymentId = context.paymentId;
 if (paymentId) {
-    payment = delegator.findOne("Payment", [paymentId : paymentId], false);
+    payment = from("Payment").where("paymentId", paymentId).queryOne();
     if (payment) payments.add(payment);
     context.payments = payments;
     return;
@@ -54,12 +54,12 @@ if (paymentId) {
 // in the case of a multi form, parse the multi data and get all of the selected payments
 selected = UtilHttp.parseMultiFormData(parameters);
 selected.each { row ->
-    payment = delegator.findOne("Payment", [paymentId : row.paymentId], false);
+    payment = from("Payment").where("paymentId", row.paymentId).queryOne();
     if (payment) {
         payments.add(payment);
     }
 }
-paymentGroupMembers = EntityUtil.filterByDate(delegator.findList("PaymentGroupMember", EntityCondition.makeCondition("paymentGroupId", EntityOperator.EQUALS, parameters.paymentGroupId), null, null, null, false));
+paymentGroupMembers = from("PaymentGroupMember").where("paymentGroupId", parameters.paymentGroupId).filterByDate().queryList();
 //in the case of a multiple payments, paymentId List is supplied.
 paymentGroupMembers.each { paymentGropupMember->
     payments.add(paymentGropupMember.getRelatedOne("Payment", false));

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/period/EditCustomTimePeriod.groovy Mon Jan  5 08:50:30 2015
@@ -33,7 +33,7 @@ if (currentCustomTimePeriodId) {
     context.currentCustomTimePeriodId = currentCustomTimePeriodId;
 }
 
-currentCustomTimePeriod = currentCustomTimePeriodId ? delegator.findOne("CustomTimePeriod", [customTimePeriodId : currentCustomTimePeriodId], false) : null;
+currentCustomTimePeriod = currentCustomTimePeriodId ? from("CustomTimePeriod").where("customTimePeriodId", currentCustomTimePeriodId).queryOne() : null;
 if (currentCustomTimePeriod) {
     context.currentCustomTimePeriod = currentCustomTimePeriod;
 }
@@ -47,13 +47,13 @@ findMap = [ : ];
 if (findOrganizationPartyId) findMap.organizationPartyId = findOrganizationPartyId;
 if (currentCustomTimePeriodId) findMap.parentPeriodId = currentCustomTimePeriodId;
 
-customTimePeriods = delegator.findByAnd("CustomTimePeriod", findMap, ["periodTypeId", "periodNum", "fromDate"], false);
+customTimePeriods = from("CustomTimePeriod").where(findMap).orderBy(["periodTypeId", "periodNum", "fromDate"]).queryList();
 context.customTimePeriods = customTimePeriods;
 
-allCustomTimePeriods = delegator.findList("CustomTimePeriod", null, null, ["organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"], null, false);
+allCustomTimePeriods = from("CustomTimePeriod").orderBy(["organizationPartyId", "parentPeriodId", "periodTypeId", "periodNum", "fromDate"]).queryList();
 context.allCustomTimePeriods = allCustomTimePeriods;
 
-periodTypes = delegator.findList("PeriodType", null, null, ["description"], null, true);
+periodTypes = from("PeriodType").orderBy("description").cache(true).queryList();
 context.periodTypes = periodTypes;
 
 newPeriodTypeId = "FISCAL_YEAR";

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/BalanceSheet.groovy Mon Jan  5 08:50:30 2015
@@ -45,27 +45,27 @@ List partyIds = PartyWorker.getAssociate
 partyIds.add(organizationPartyId);
 
 // Get the group of account classes that will be used to position accounts in the proper section of the financial statement
-GenericValue assetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ASSET"), true);
+GenericValue assetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ASSET").cache(true).queryOne();
 List assetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(assetGlAccountClass);
-GenericValue contraAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CONTRA_ASSET"), true);
+GenericValue contraAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_ASSET").cache(true).queryOne();
 List contraAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraAssetGlAccountClass);
-GenericValue liabilityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "LIABILITY"), true);
+GenericValue liabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LIABILITY").cache(true).queryOne();
 List liabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(liabilityGlAccountClass);
-GenericValue equityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "EQUITY"), true);
+GenericValue equityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EQUITY").cache(true).queryOne();
 List equityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(equityGlAccountClass);
-GenericValue currentAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CURRENT_ASSET"), true);
+GenericValue currentAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_ASSET").cache(true).queryOne();
 List currentAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentAssetGlAccountClass);
-GenericValue longtermAssetGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "LONGTERM_ASSET"), true);
+GenericValue longtermAssetGlAccountClass = from("GlAccountClass").where("glAccountClassId", "LONGTERM_ASSET").cache(true).queryOne();
 List longtermAssetAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(longtermAssetGlAccountClass);
-GenericValue currentLiabilityGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CURRENT_LIABILITY"), true);
+GenericValue currentLiabilityGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CURRENT_LIABILITY").cache(true).queryOne();
 List currentLiabilityAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(currentLiabilityGlAccountClass);
-GenericValue accumDepreciationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ACCUM_DEPRECIATION"), true);
+GenericValue accumDepreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_DEPRECIATION").cache(true).queryOne();
 List accumDepreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumDepreciationGlAccountClass);
-GenericValue accumAmortizationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "ACCUM_AMORTIZATION"), true);
+GenericValue accumAmortizationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "ACCUM_AMORTIZATION").cache(true).queryOne();
 List accumAmortizationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(accumAmortizationGlAccountClass);
 
 // Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period
-Map lastClosedTimePeriodResult = dispatcher.runSync("findLastClosedDate", UtilMisc.toMap("organizationPartyId", organizationPartyId, "findDate", new Date(thruDate.getTime()),"userLogin", userLogin));
+Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId": organizationPartyId, "findDate": new Date(thruDate.getTime()),"userLogin": userLogin]);
 Timestamp fromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
 if (!fromDate) {
     return;
@@ -85,7 +85,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    List lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
         assetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
@@ -95,7 +95,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
         contraAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
@@ -105,7 +105,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
         liabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
@@ -115,7 +115,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
         equityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
@@ -125,7 +125,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
         currentAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
@@ -135,7 +135,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
         longtermAssetOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
@@ -145,7 +145,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = UtilMisc.toMap("glAccountId", lastTimePeriodHistory.glAccountId, "accountCode", lastTimePeriodHistory.accountCode, "accountName", lastTimePeriodHistory.accountName, "balance", lastTimePeriodHistory.getBigDecimal("endingBalance"), "D", lastTimePeriodHistory.getBigDecimal("postedDebits"), "C", lastTimePeriodHistory.getBigDecimal("postedCredits"));
         currentLiabilityOpeningBalances.put(lastTimePeriodHistory.glAccountId, accountMap);
@@ -169,8 +169,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List assetAndExprs = FastList.newInstance(mainAndExprs);
 assetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, assetAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(assetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
-
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(assetAndExprs).orderBy("glAccountId").queryList();
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(assetOpeningBalances);
 transactionTotals.each { transactionTotal ->
@@ -206,7 +205,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List currentAssetAndExprs = FastList.newInstance(mainAndExprs);
 currentAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentAssetAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(currentAssetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentAssetAndExprs).orderBy("glAccountId").queryList();
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(currentAssetOpeningBalances);
 transactionTotals.each { transactionTotal ->
@@ -241,7 +240,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List longtermAssetAndExprs = FastList.newInstance(mainAndExprs);
 longtermAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, longtermAssetAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(longtermAssetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").orderBy("glAccountId").queryList();
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(longtermAssetOpeningBalances);
 transactionTotals.each { transactionTotal ->
@@ -276,7 +275,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List contraAssetAndExprs = FastList.newInstance(mainAndExprs);
 contraAssetAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraAssetAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(contraAssetAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraAssetAndExprs).orderBy("glAccountId").queryList();
 
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(contraAssetOpeningBalances);
@@ -317,7 +316,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List liabilityAndExprs = FastList.newInstance(mainAndExprs);
 liabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, liabilityAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(liabilityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(liabilityAndExprs).orderBy("glAccountId").queryList();
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(liabilityOpeningBalances);
 transactionTotals.each { transactionTotal ->
@@ -353,7 +352,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List currentLiabilityAndExprs = FastList.newInstance(mainAndExprs);
 currentLiabilityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, currentLiabilityAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(currentLiabilityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(currentLiabilityAndExprs).orderBy("glAccountId").queryList();
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(currentLiabilityOpeningBalances);
 transactionTotals.each { transactionTotal ->
@@ -388,7 +387,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List equityAndExprs = FastList.newInstance(mainAndExprs);
 equityAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, equityAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(equityAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(equityAndExprs).orderBy("glAccountId").queryList();
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(equityOpeningBalances);
 transactionTotals.each { transactionTotal ->
@@ -410,9 +409,9 @@ transactionTotals.each { transactionTota
     transactionTotalsMap.put(transactionTotal.glAccountId, accountMap);
 }
 // Add the "retained earnings" account
-Map netIncomeResult = dispatcher.runSync("prepareIncomeStatement", UtilMisc.toMap("organizationPartyId", organizationPartyId, "glFiscalTypeId", glFiscalTypeId, "fromDate", fromDate, "thruDate", thruDate,"userLogin", userLogin));
+Map netIncomeResult = runService('prepareIncomeStatement', ["organizationPartyId": organizationPartyId, "glFiscalTypeId": glFiscalTypeId, "fromDate": fromDate, "thruDate": thruDate, "userLogin": userLogin]);
 BigDecimal netIncome = (BigDecimal)netIncomeResult.totalNetIncome;
-GenericValue retainedEarningsAccount = delegator.findOne("GlAccountTypeDefault", UtilMisc.toMap("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId), true);
+GenericValue retainedEarningsAccount = from("GlAccountTypeDefault").where("glAccountTypeId", "RETAINED_EARNINGS", "organizationPartyId", organizationPartyId).cache(true).queryOne();
 if (retainedEarningsAccount) {
     GenericValue retainedEarningsGlAccount = retainedEarningsAccount.getRelatedOne("GlAccount", false);
     transactionTotalsMap.put(retainedEarningsGlAccount.glAccountId, UtilMisc.toMap("glAccountId", retainedEarningsGlAccount.glAccountId,"accountName", retainedEarningsGlAccount.accountName, "accountCode", retainedEarningsGlAccount.accountCode, "balance", netIncome));

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CashFlowStatement.groovy Mon Jan  5 08:50:30 2015
@@ -50,13 +50,13 @@ List partyIds = PartyWorker.getAssociate
 partyIds.add(organizationPartyId);
 
 // Get the group of account classes that will be used to position accounts in the proper section of the  Cash Flow statement
-GenericValue glAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CASH_EQUIVALENT"), true);
+GenericValue glAccountClass = from("GlAccountClass").where("glAccountClassId", "CASH_EQUIVALENT").cache(true).queryOne();
 List glAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(glAccountClass);
 
 List cashFlowBalanceTotalList = [];
 
 // Find the last closed time period to get the fromDate for the transactions in the current period and the ending balances of the last closed period 
-Map lastClosedTimePeriodResult = dispatcher.runSync("findLastClosedDate", ["organizationPartyId":organizationPartyId, "findDate":new Date(parametersFromDate.getTime()),"userLogin":userLogin]);
+Map lastClosedTimePeriodResult = runService('findLastClosedDate', ["organizationPartyId":organizationPartyId, "findDate":new Date(parametersFromDate.getTime()),"userLogin":userLogin]);
 Timestamp periodClosingFromDate = (Timestamp)lastClosedTimePeriodResult.lastClosedDate;
 if (!periodClosingFromDate) {
     return;
@@ -70,7 +70,7 @@ if (lastClosedTimePeriod) {
     timePeriodAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, glAccountClassIds));
     timePeriodAndExprs.add(EntityCondition.makeCondition("endingBalance", EntityOperator.NOT_EQUAL, BigDecimal.ZERO));
     timePeriodAndExprs.add(EntityCondition.makeCondition("customTimePeriodId", EntityOperator.EQUALS, lastClosedTimePeriod.customTimePeriodId));
-    List lastTimePeriodHistories = delegator.findList("GlAccountAndHistory", EntityCondition.makeCondition(timePeriodAndExprs, EntityOperator.AND), null, null, null, false);
+    List lastTimePeriodHistories = from("GlAccountAndHistory").where(timePeriodAndExprs).queryList();
     lastTimePeriodHistories.each { lastTimePeriodHistory ->
         Map accountMap = ["glAccountId":lastTimePeriodHistory.glAccountId, "accountCode":lastTimePeriodHistory.accountCode, "accountName":lastTimePeriodHistory.accountName, "balance":lastTimePeriodHistory.getBigDecimal("endingBalance"), "D":lastTimePeriodHistory.getBigDecimal("postedDebits"), "C":lastTimePeriodHistory.getBigDecimal("postedCredits")];
         openingCashBalances.(lastTimePeriodHistory.glAccountId) = accountMap;
@@ -90,7 +90,7 @@ balanceTotal = BigDecimal.ZERO;
 List openingCashBalanceAndExprs = FastList.newInstance(mainAndExprs);
 openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, periodClosingFromDate));
 openingCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, parametersFromDate));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(openingCashBalanceAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(openingCashBalanceAndExprs).orderBy("glAccountId").queryList();
 transactionTotalsMap = [:];
 transactionTotalsMap.putAll(openingCashBalances);
 transactionTotals.each { transactionTotal ->
@@ -135,7 +135,7 @@ balanceTotal = BigDecimal.ZERO;
 List periodCashBalanceAndExprs = FastList.newInstance(mainAndExprs);
 periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, parametersFromDate));
 periodCashBalanceAndExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN, thruDate));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(periodCashBalanceAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(periodCashBalanceAndExprs).orderBy("glAccountId").queryList();
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
@@ -214,7 +214,7 @@ context.closingCashBalanceList.add("acco
 if (closingTransactionKeySet) {
     closingTransactionKeySet.removeAll(openingTransactionKeySet);
     closingTransactionKeySet.each { closingTransactionKey ->
-        glAccount = delegator.findOne("GlAccount", UtilMisc.toMap("glAccountId", closingTransactionKey), true);
+        glAccount = from("GlAccount").where("glAccountId", closingTransactionKey).cache(true).queryOne();
         context.openingCashBalanceList.add(["glAccountId":glAccount.glAccountId, "accountName":glAccount.accountName, accountCode:glAccount.accountCode, balance:BigDecimal.ZERO, D:BigDecimal.ZERO, C:BigDecimal.ZERO]);
     }
 }

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/CostCenters.groovy Mon Jan  5 08:50:30 2015
@@ -48,9 +48,9 @@ andExprs.add(EntityCondition.makeConditi
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate));
 andExprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate));
 andCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND);
-List postedTransactionTotals = delegator.findList("AcctgTransEntrySums", andCond, UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+List postedTransactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(andCond).orderBy("glAccountId").queryList();
 if (postedTransactionTotals) {
-    glAccountCategories = delegator.findByAnd("GlAccountCategory", [glAccountCategoryTypeId : 'COST_CENTER'], ['glAccountCategoryId'], false);
+    glAccountCategories = from("GlAccountCategory").where("glAccountCategoryTypeId", "COST_CENTER").orderBy("glAccountCategoryId").queryList();
     context.glAccountCategories = glAccountCategories;
     Map postedTransactionTotalsMap = [:]
     postedTransactionTotals.each { postedTransactionTotal ->
@@ -67,7 +67,7 @@ if (postedTransactionTotals) {
         BigDecimal balance = debitAmount.subtract(creditAmount);
         accountMap.put("balance", balance);
         glAccountCategories.each { glAccountCategory ->
-            glAccountCategoryMember = EntityUtil.getFirst(EntityUtil.filterByDate(delegator.findByAnd("GlAccountCategoryMember", [glAccountCategoryId : glAccountCategory.glAccountCategoryId, glAccountId: postedTransactionTotal.glAccountId], ['glAccountCategoryId'], false)));
+            glAccountCategoryMember = from("GlAccountCategoryMember").where("glAccountCategoryId", glAccountCategory.glAccountCategoryId, "glAccountId", postedTransactionTotal.glAccountId).orderBy("glAccountCategoryId").filterByDate().queryFirst();
             if (glAccountCategoryMember) {
                 BigDecimal glAccountCategorySharePercentage = glAccountCategoryMember.amountPercentage;
                 if (glAccountCategorySharePercentage && glAccountCategorySharePercentage != BigDecimal.ZERO ) {

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/GlAccountTrialBalance.groovy Mon Jan  5 08:50:30 2015
@@ -26,16 +26,16 @@ import com.ibm.icu.util.Calendar;
 if (organizationPartyId) {
     onlyIncludePeriodTypeIdList = [];
     onlyIncludePeriodTypeIdList.add("FISCAL_YEAR");
-    customTimePeriodResults = dispatcher.runSync("findCustomTimePeriods", [findDate : UtilDateTime.nowTimestamp(), organizationPartyId : organizationPartyId, onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]);
+    customTimePeriodResults = runService('findCustomTimePeriods', [findDate : UtilDateTime.nowTimestamp(), organizationPartyId : organizationPartyId, onlyIncludePeriodTypeIdList : onlyIncludePeriodTypeIdList, userLogin : userLogin]);
     customTimePeriodList = customTimePeriodResults.customTimePeriodList;
     if (UtilValidate.isNotEmpty(customTimePeriodList)) {
         context.timePeriod = customTimePeriodList.first().customTimePeriodId;
     }
     decimals = UtilNumber.getBigDecimalScale("ledger.decimals");
     rounding = UtilNumber.getBigDecimalRoundingMode("ledger.rounding");
-    context.currentOrganization = delegator.findOne("PartyNameView", [partyId : organizationPartyId], false);
+    context.currentOrganization = from("PartyNameView").where("partyId", organizationPartyId).queryOne();
     if (parameters.glAccountId) {
-        glAccount = delegator.findOne("GlAccount", [glAccountId : parameters.glAccountId], false);
+        glAccount = from("GlAccount").where("glAccountId", parameters.glAccountId).queryOne();
         isDebitAccount = UtilAccounting.isDebitAccount(glAccount);
         context.isDebitAccount = isDebitAccount;
         context.glAccount = glAccount;
@@ -45,13 +45,11 @@ if (organizationPartyId) {
     BigDecimal balanceOfTheAcctgForYear = BigDecimal.ZERO;
 
     if (parameters.timePeriod) {
-        currentTimePeriod = delegator.findOne("CustomTimePeriod", [customTimePeriodId : parameters.timePeriod], false);
-        previousTimePeriodResult = dispatcher.runSync("getPreviousTimePeriod", 
-                [customTimePeriodId : parameters.timePeriod, userLogin : userLogin]);
+        currentTimePeriod = from("CustomTimePeriod").where("customTimePeriodId", parameters.timePeriod).queryOne();
+        previousTimePeriodResult = runService('getPreviousTimePeriod', [customTimePeriodId : parameters.timePeriod, userLogin : userLogin]);
         previousTimePeriod = previousTimePeriodResult.previousTimePeriod;
         if (UtilValidate.isNotEmpty(previousTimePeriod)) {
-            glAccountHistory = delegator.findOne("GlAccountHistory", 
-                    [customTimePeriodId : previousTimePeriod.customTimePeriodId, glAccountId : parameters.glAccountId, organizationPartyId : organizationPartyId], false);
+            glAccountHistory = from("GlAccountHistory").where("customTimePeriodId", previousTimePeriod.customTimePeriodId, "glAccountId", parameters.glAccountId, "organizationPartyId", organizationPartyId).queryOne();
             if (glAccountHistory && glAccountHistory.endingBalance != null) {
                 context.openingBalance = glAccountHistory.endingBalance;
                 balanceOfTheAcctgForYear = glAccountHistory.endingBalance;
@@ -76,7 +74,7 @@ if (organizationPartyId) {
             if ("ALL".equals(isPosted)) {
                 isPosted = "";
             }
-            acctgTransEntriesAndTransTotal = dispatcher.runSync("getAcctgTransEntriesAndTransTotal", 
+            acctgTransEntriesAndTransTotal = runService('getAcctgTransEntriesAndTransTotal', 
                     [customTimePeriodStartDate : customTimePeriodStartDate, customTimePeriodEndDate : customTimePeriodEndDate, organizationPartyId : organizationPartyId, glAccountId : parameters.glAccountId, isPosted : isPosted, userLogin : userLogin]);
             totalOfYearToDateDebit = totalOfYearToDateDebit + acctgTransEntriesAndTransTotal.debitTotal;
             acctgTransEntriesAndTransTotal.totalOfYearToDateDebit = totalOfYearToDateDebit.setScale(decimals, rounding);

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy Mon Jan  5 08:50:30 2015
@@ -42,19 +42,19 @@ List partyIds = PartyWorker.getAssociate
 partyIds.add(organizationPartyId);
 
 // Get the group of account classes that will be used to position accounts in the proper section of the financial statement
-GenericValue revenueGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "REVENUE"), true);
+GenericValue revenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "REVENUE").cache(true).queryOne();
 List revenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(revenueGlAccountClass);
-GenericValue contraRevenueGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "CONTRA_REVENUE"), true);
+GenericValue contraRevenueGlAccountClass = from("GlAccountClass").where("glAccountClassId", "CONTRA_REVENUE").cache(true).queryOne();
 List contraRevenueAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(contraRevenueGlAccountClass);
-GenericValue incomeGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "INCOME"), true);
+GenericValue incomeGlAccountClass = from("GlAccountClass").where("glAccountClassId", "INCOME").cache(true).queryOne();
 List incomeAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(incomeGlAccountClass);
-GenericValue expenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "EXPENSE"), true);
+GenericValue expenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "EXPENSE").cache(true).queryOne();
 List expenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(expenseGlAccountClass);
-GenericValue cogsExpenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "COGS_EXPENSE"), true);
+GenericValue cogsExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "COGS_EXPENSE").cache(true).queryOne();
 List cogsExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(cogsExpenseGlAccountClass);
-GenericValue sgaExpenseGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "SGA_EXPENSE"), true);
+GenericValue sgaExpenseGlAccountClass = from("GlAccountClass").where("glAccountClassId", "SGA_EXPENSE").cache(true).queryList();
 List sgaExpenseAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(sgaExpenseGlAccountClass);
-GenericValue depreciationGlAccountClass = delegator.findOne("GlAccountClass", UtilMisc.toMap("glAccountClassId", "DEPRECIATION"), true);
+GenericValue depreciationGlAccountClass = from("GlAccountClass").where("glAccountClassId", "DEPRECIATION").cache(true).queryOne();
 List depreciationAccountClassIds = UtilAccounting.getDescendantGlAccountClassIds(depreciationGlAccountClass);
 
 List mainAndExprs = FastList.newInstance();
@@ -74,7 +74,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List revenueAndExprs = FastList.newInstance(mainAndExprs);
 revenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, revenueAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(revenueAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(revenueAndExprs).orderBy("glAccountId").queryList();
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
@@ -117,7 +117,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List contraRevenueAndExprs = FastList.newInstance(mainAndExprs);
 contraRevenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraRevenueAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(contraRevenueAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(contraRevenueAndExprs).orderBy("glAccountId").queryList();
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
@@ -159,7 +159,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List expenseAndExprs = FastList.newInstance(mainAndExprs);
 expenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, expenseAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(expenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(expenseAndExprs).queryList();
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
@@ -202,7 +202,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List cogsExpenseAndExprs = FastList.newInstance(mainAndExprs);
 cogsExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, cogsExpenseAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(cogsExpenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(cogsExpenseAndExprs).orderBy("glAccountId").queryList();
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
@@ -244,7 +244,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List sgaExpenseAndExprs = FastList.newInstance(mainAndExprs);
 sgaExpenseAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, sgaExpenseAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(sgaExpenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(sgaExpenseAndExprs).orderBy("glAccountId").queryList();
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;
@@ -285,7 +285,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List depreciationAndExprs = FastList.newInstance(mainAndExprs);
 depreciationAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, depreciationAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(depreciationAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(depreciationAndExprs).orderBy("glAccountId").queryList();
 if (transactionTotals) {
 Map transactionTotalsMap = [:];
 balanceTotalCredit = BigDecimal.ZERO;
@@ -326,7 +326,7 @@ transactionTotals = [];
 balanceTotal = BigDecimal.ZERO;
 List incomeAndExprs = FastList.newInstance(mainAndExprs);
 incomeAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, incomeAccountClassIds));
-transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(incomeAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false);
+transactionTotals = select("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount").from("AcctgTransEntrySums").where(incomeAndExprs).orderBy("glAccountId").queryList();
 if (transactionTotals) {
     Map transactionTotalsMap = [:];
     balanceTotalCredit = BigDecimal.ZERO;

Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff
==============================================================================
--- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy (original)
+++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy Mon Jan  5 08:50:30 2015
@@ -31,8 +31,8 @@ import org.ofbiz.entity.util.*;
 //TODO:
 
 // get products and categories under the root category
-productMemberList = delegator.findByAnd("ProductCategoryMember", [productCategoryId : rootProductCategoryId], ["sequenceNum"], false);
-categoryRollupList = delegator.findByAnd("ProductCategoryRollup", [parentProductCategoryId : rootProductCategoryId], ["sequenceNum"], false);
+productMemberList = from("ProductCategoryMember").where("productCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList();
+categoryRollupList = from("ProductCategoryRollup").where("parentProductCategoryId", rootProductCategoryId).orderBy("sequenceNum").queryList();
 
 // for use in the queries
 productIdSet = FastSet.newInstance();
@@ -55,8 +55,6 @@ categoryRollupList.each { categoryRollup
     productCategoryIdSet.add(categoryRollup.productCategoryId);
 }
 
-productFieldsToSelect = UtilMisc.toSet("productId", "quantityTotal", "amountTotal");
-
 //NOTE: tax, etc also have productId on them, so restrict by type INV_PROD_ITEM, INV_FPROD_ITEM, INV_DPROD_ITEM, others?
 baseProductAndExprs = FastList.newInstance();
 baseProductAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"));
@@ -65,8 +63,6 @@ baseProductAndExprs.add(EntityCondition.
 if (organizationPartyId) baseProductAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId));
 if (currencyUomId) baseProductAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId));
 
-categoryFieldsToSelect = UtilMisc.toSet("productCategoryId", "quantityTotal", "amountTotal");
-
 baseCategoryAndExprs = FastList.newInstance();
 baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceTypeId", EntityOperator.EQUALS, "SALES_INVOICE"));
 baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"]));
@@ -104,8 +100,6 @@ for (int currentDay = 0; currentDay <= d
     currentDayCal.add(Calendar.DAY_OF_MONTH, 1);
     nextDayBegin = new java.sql.Timestamp(currentDayCal.getTimeInMillis());
 
-    findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
-
     // do the product find
     productAndExprs = FastList.newInstance();
     productAndExprs.addAll(baseProductAndExprs);
@@ -113,7 +107,7 @@ for (int currentDay = 0; currentDay <= d
     productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
     productAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
 
-    productResultListIterator = delegator.find("InvoiceItemProductSummary", EntityCondition.makeCondition(productAndExprs, EntityOperator.AND), null, productFieldsToSelect, null, findOpts);
+    productResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
     productResultMap = FastMap.newInstance();
     while ((productResult = productResultListIterator.next())) {
         productResultMap[productResult.productId] = productResult;
@@ -130,7 +124,7 @@ for (int currentDay = 0; currentDay <= d
     categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
     categoryAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
 
-    categoryResultListIterator = delegator.find("InvoiceItemCategorySummary", EntityCondition.makeCondition(categoryAndExprs, EntityOperator.AND), null, categoryFieldsToSelect, null, findOpts);
+    categoryResultListIterator = select("productCategoryId", "quantityTotal", "amountTotal").from(InvoiceItemCategorySummary).where(categoryAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
     categoryResultMap = FastMap.newInstance();
     while ((categoryResult = categoryResultListIterator.next())) {
         categoryResultMap[categoryResult.productCategoryId] = categoryResult;
@@ -147,7 +141,7 @@ for (int currentDay = 0; currentDay <= d
     productNullAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, null));
     productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.GREATER_THAN_EQUAL_TO, currentDayBegin));
     productNullAndExprs.add(EntityCondition.makeCondition("invoiceDate", EntityOperator.LESS_THAN, nextDayBegin));
-    productNullResultListIterator = delegator.find("InvoiceItemProductSummary", EntityCondition.makeCondition(productNullAndExprs, EntityOperator.AND), null, productFieldsToSelect, null, findOpts);
+    productNullResultListIterator = select("productId", "quantityTotal", "amountTotal").from("InvoiceItemProductSummary").where(productNullAndExprs).cursorScrollInsensitive().cache(true).queryIterator();
     // should just be 1 result
     productNullResult = productNullResultListIterator.next();
     productNullResultListIterator.close();