Author: lektran
Date: Sat May 31 16:53:49 2008 New Revision: 662107 URL: http://svn.apache.org/viewvc?rev=662107&view=rev Log: Some more bsh -> groovy conversions Added: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy (contents, props changed) - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.groovy - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.groovy - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.groovy - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.groovy - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.groovy - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.groovy - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy - copied, changed from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (contents, props changed) - copied, changed from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh Removed: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.bsh ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy Sat May 31 16:53:49 2008 @@ -21,23 +21,21 @@ import org.ofbiz.entity.util.EntityUtil; import javolution.util.FastMap; -if(billingAccountId != null) { - List orderPaymentPreferencesList = new LinkedList(); - orderList = delegator.findByAnd("OrderHeader", UtilMisc.toMap("billingAccountId", billingAccountId)); - if(orderList != null) { - itr = orderList.iterator(); - while(itr.hasNext()) { - GenericValue orderHeader = itr.next(); - orderId = orderHeader.get("orderId"); - orderBillingAcc = EntityUtil.getFirst(delegator.findByAnd("OrderHeaderAndPaymentPref", UtilMisc.toMap("orderId", orderId))); - Map orderBillingAccMap = FastMap.newInstance(); - if(orderBillingAcc.getString("paymentMethodTypeId").equals("EXT_BILLACT") && orderBillingAcc.getString("paymentStatusId").equals("PAYMENT_NOT_RECEIVED")) { - orderBillingAccMap.putAll((Map) orderBillingAcc); - orderId = orderBillingAcc.get("orderId"); - orderBillingAccMap.put("orderId", orderId); - } +if(billingAccountId) { + orderPaymentPreferencesList = []; + orderList = delegator.findByAnd("OrderHeader", [billingAccountId : billingAccountId]); + if(orderList) { + orderList.each { orderHeader -> + orderId = orderHeader.orderId; + orderBillingAcc = EntityUtil.getFirst(delegator.findByAnd("OrderHeaderAndPaymentPref", [orderId : orderId])); + orderBillingAccMap = FastMap.newInstance(); + if(orderBillingAcc.paymentMethodTypeId.equals("EXT_BILLACT") && orderBillingAcc.paymentStatusId.equals("PAYMENT_NOT_RECEIVED")) { + orderBillingAccMap.putAll(orderBillingAcc); + orderId = orderBillingAcc.orderId; + orderBillingAccMap.orderId = orderId; + } orderPaymentPreferencesList.add(orderBillingAccMap); } - context.put("orderPaymentPreferencesList", orderPaymentPreferencesList); + context.orderPaymentPreferencesList = orderPaymentPreferencesList; } } \ No newline at end of file Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/order/billingAccountOrders.goovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.groovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/editPayment.groovy Sat May 31 16:53:49 2008 @@ -21,24 +21,20 @@ import org.ofbiz.entity.*; import org.ofbiz.widget.html.HtmlFormWrapper; -delegator = request.getAttribute("delegator"); -paymentId = request.getParameter("paymentId"); -if (paymentId == null) { - paymentId = request.getAttribute("paymentId"); -} +paymentId = request.getParameter("paymentId") ?:request.getAttribute("paymentId"); payment = null; -if (UtilValidate.isNotEmpty(paymentId)) { - payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); +if (paymentId) { + payment = delegator.findByPrimaryKey("Payment", [paymentId : paymentId]); } -context.put("payment", payment); +context.payment = payment; currentType = null; currentStatus = null; currentMethod = null; paymentApplications = null; -if (payment != null) { +if (payment) { // get the current type currentType = payment.getRelatedOne("PaymentType"); // get the current status @@ -50,27 +46,26 @@ HtmlFormWrapper paymentApplicationsWrapper = new HtmlFormWrapper("component://accounting/webapp/accounting/payment/PaymentForms.xml", "PaymentApplicationsList", request, response); paymentApplicationsWrapper.putInContext("entityList", paymentApplications); paymentApplicationsWrapper.putInContext("uiLabelMap", request.getAttribute("uiLabelMap")); - context.put("paymentApplicationsWrapper", paymentApplicationsWrapper); + context.paymentApplicationsWrapper = paymentApplicationsWrapper; HtmlFormWrapper editPaymentApplicationWrapper = new HtmlFormWrapper("component://accounting/webapp/accounting/payment/PaymentForms.xml", "EditPaymentApplication", request, response); editPaymentApplicationWrapper.putInContext("paymentApplication", null); editPaymentApplicationWrapper.putInContext("paymentId", paymentId); editPaymentApplicationWrapper.putInContext("uiLabelMap", request.getAttribute("uiLabelMap")); - context.put("editPaymentApplicationWrapper", editPaymentApplicationWrapper); + context.editPaymentApplicationWrapper = editPaymentApplicationWrapper; } -context.put("currentType", currentType); -context.put("currentStatus", currentStatus); -context.put("currentMethod", currentMethod); -context.put("paymentApplications", paymentApplications); +context.currentType = currentType; +context.currentStatus = currentStatus; +context.currentMethod = currentMethod; +context.paymentApplications = paymentApplications; // get the payment types -paymentTypes = delegator.findList("PaymentType", null, null, UtilMisc.toList("description"), null, false); -context.put("paymentTypes", paymentTypes); +paymentTypes = delegator.findList("PaymentType", null, null, ["description"], null, false); +context.paymentTypes = paymentTypes; // get the payment statuses -paymentStatuses = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", "PMNT_STATUS"), UtilMisc.toList("sequenceId", "description")); -context.put("paymentStatuses", paymentStatuses); +paymentStatuses = delegator.findByAnd("StatusItem", [statusTypeId : "PMNT_STATUS"], ["sequenceId", "description"]); +context.paymentStatuses = paymentStatuses; // get the payment method types -paymentMethodTypes = delegator.findList("PaymentMethodType", null, null, UtilMisc.toList("description"), null, false); -context.put("paymentMethodTypes", paymentMethodTypes); - +paymentMethodTypes = delegator.findList("PaymentMethodType", null, null, ["description"], null, false); +context.paymentMethodTypes = paymentMethodTypes; Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.groovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/findPayment.groovy Sat May 31 16:53:49 2008 @@ -23,32 +23,30 @@ import org.ofbiz.entity.condition.*; import org.ofbiz.base.util.*; -delegator = request.getAttribute("delegator"); - // get the payment types -paymentTypes = delegator.findList("PaymentType", null, null, UtilMisc.toList("description"), null, false); -context.put("paymentTypes", paymentTypes); +paymentTypes = delegator.findList("PaymentType", null, null, ["description"], null, false); +context.paymentTypes = paymentTypes; // get the payment statuses -paymentStatuses = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", "PMNT_STATUS"), UtilMisc.toList("sequenceId", "description")); -context.put("paymentStatuses", paymentStatuses); +paymentStatuses = delegator.findByAnd("StatusItem", [statusTypeId : "PMNT_STATUS"], ["sequenceId", "description"]); +context.paymentStatuses = paymentStatuses; // get the payment method types -paymentMethodTypes = delegator.findList("PaymentMethodType", null, null, UtilMisc.toList("description"), null, false); -context.put("paymentMethodTypes", paymentMethodTypes); +paymentMethodTypes = delegator.findList("PaymentMethodType", null, null, ["description"], null, false); +context.paymentMethodTypes = paymentMethodTypes; // current selected status currentStatusId = request.getParameter("paymentStatusId"); -if (currentStatusId != null && currentStatusId.length() > 0) { - currentStatus = delegator.findByPrimaryKey("StatusItem", UtilMisc.toMap("statusId", currentStatusId)); - context.put("currentStatus", currentStatus); +if (currentStatusId) { + currentStatus = delegator.findByPrimaryKey("StatusItem", [statusId : currentStatusId]); + context.currentStatus = currentStatus; } // current selected payment method currentMethodId = request.getParameter("paymentMethodTypeId"); -if (currentMethodId != null && currentMethodId.length() > 0) { - currentMethod = delegator.findByPrimaryKey("PaymentMethodType", UtilMisc.toMap("paymentMethodTypeId", currentMethodId)); - context.put("currentMethod", currentMethod); +if (currentMethodId) { + currentMethod = delegator.findByPrimaryKey("PaymentMethodType", [paymentMethodTypeId : currentMethodId]); + context.currentMethod = currentMethod; } @@ -63,7 +61,7 @@ fromTs = new Timestamp(fromCal.getTimeInMillis()); fromStr = fromTs.toString(); fromStr = fromStr.substring(0, fromStr.indexOf('.')); -context.put("fromDateStr", fromStr); +context.fromDateStr = fromStr; // create the thruDate for calendar toCal = Calendar.getInstance(); @@ -75,7 +73,7 @@ toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)); toTs = new Timestamp(toCal.getTimeInMillis()); toStr = toTs.toString(); -context.put("thruDateStr", toStr); +context.thruDateStr = toStr; // get the lookup flag lookupFlag = request.getParameter("lookupFlag"); @@ -84,17 +82,17 @@ paramList = ""; paymentList = null; -if (lookupFlag != null) { - paramList = paramList + "&lookupFlag=" + lookupFlag; +if (lookupFlag) { + paramList += "&lookupFlag=" + lookupFlag; lookupErrorMessage = null; - andExprs = new ArrayList(); + andExprs = []; entityName = "Payment"; - + // define the main condition mainCond = null; // now do the filtering - if (lookupErrorMessage == null) { + if (!lookupErrorMessage) { paymentType = request.getParameter("paymentType"); paymentStatus = request.getParameter("paymentStatusId"); paymentMethodType = request.getParameter("paymentMethodTypeId"); @@ -102,67 +100,67 @@ toPartyId = request.getParameter("toPartyId"); minDate = request.getParameter("minDate"); maxDate = request.getParameter("maxDate"); + + if (!paymentType) paymentType = "ANY"; + if (!paymentStatus) paymentStatus = "ANY"; + if (!paymentMethodType) paymentMethodType = "ANY"; - if (paymentType == null) paymentType = "ANY"; - if (paymentStatus == null) paymentStatus = "ANY"; - if (paymentMethodType == null) paymentMethodType = "ANY"; - - paramList = paramList + "&paymentTypeId=" + paymentType; + paramList += "&paymentTypeId=" + paymentType; if (!"ANY".equals(paymentType)) { andExprs.add(EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, paymentType)); } - paramList = paramList + "&paymentStatusId=" + paymentStatus; + paramList += "&paymentStatusId=" + paymentStatus; if (!"ANY".equals(paymentStatus)) { andExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, paymentStatus)); } - paramList = paramList + "&paymentMethodTypeId=" + paymentMethodType; + paramList += "&paymentMethodTypeId=" + paymentMethodType; if (!"ANY".equals(paymentMethodType)) { andExprs.add(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.EQUALS, paymentMethodType)); } - - if (UtilValidate.isNotEmpty(fromPartyId)) { - paramList = paramList + "&fromPartyId=" + fromPartyId; + + if (fromPartyId) { + paramList += "&fromPartyId=" + fromPartyId; andExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, fromPartyId)); - context.put("fromPartyId", fromPartyId); + context.fromPartyId = fromPartyId; } - - if (UtilValidate.isNotEmpty(toPartyId)) { - paramList = paramList + "&toPartyId=" + toPartyId; + + if (toPartyId) { + paramList += "&toPartyId=" + toPartyId; andExprs.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, toPartyId)); - context.put("toPartyId", toPartyId); + context.toPartyId = toPartyId; } - - if (minDate != null && minDate.length() > 8) { + + if (minDate && minDate.length() > 8) { minDate = minDate.trim(); if (minDate.length() < 14) minDate = minDate + " " + "00:00:00.000"; - paramList = paramList + "&minDate=" + minDate; + paramList += "&minDate=" + minDate; andExprs.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.GREATER_THAN_EQUAL_TO, ObjectType.simpleTypeConvert(minDate, "Timestamp", null, null))); } - if (maxDate != null && maxDate.length() > 8) { + if (maxDate && maxDate.length() > 8) { maxDate = maxDate.trim(); if (maxDate.length() < 14) maxDate = maxDate + " " + "23:59:59.999"; - paramList = paramList + "&maxDate=" + maxDate; + paramList += "&maxDate=" + maxDate; andExprs.add(EntityCondition.makeCondition("effectiveDate", EntityOperator.LESS_THAN_EQUAL_TO, ObjectType.simpleTypeConvert(maxDate, "Timestamp", null, null))); } - + mainCond = EntityCondition.makeCondition(andExprs, EntityOperator.AND); - + } - if (lookupErrorMessage == null && mainCond != null) { + if ((!lookupErrorMessage) && mainCond) { // do the lookup - paymentList = delegator.findList(entityName, mainCond, null, UtilMisc.toList("-effectiveDate"), null, false); - Debug.log("" + paymentList); + paymentList = delegator.findList(entityName, mainCond, null, ["-effectiveDate"], null, false); + Debug.log("" + paymentList); } + + context.paymentList = paymentList; - context.put("paymentList", paymentList); - - if (lookupErrorMessage != null) { - context.put("lookupErrorMessage", lookupErrorMessage); + if (lookupErrorMessage) { + context.lookupErrorMessage = lookupErrorMessage; } } -context.put("paramList", paramList); +context.paramList = paramList; // set the page parameters viewIndex = 0; @@ -180,7 +178,7 @@ } listSize = 0; -if (paymentList != null) { +if (paymentList) { listSize = paymentList.size(); } @@ -189,8 +187,8 @@ if (listSize < highIndex) { highIndex = listSize; } -context.put("viewIndex", viewIndex); -context.put("listSize", listSize); -context.put("highIndex", highIndex); -context.put("lowIndex", lowIndex); -context.put("viewSize", viewSize); +context.viewIndex = viewIndex; +context.listSize = listSize; +context.highIndex = highIndex; +context.lowIndex = lowIndex; +context.viewSize = viewSize; Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.groovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedInvoices.groovy Sat May 31 16:53:49 2008 @@ -27,50 +27,41 @@ import java.math.*; import java.text.NumberFormat; -Locale locale = context.get("locale"); +paymentId = parameters.paymentId; +payment = delegator.findByPrimaryKey("Payment", [paymentId : paymentId]); -paymentId = parameters.get("paymentId"); -payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); - -int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); -int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); +decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); +rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); // retrieve invoices for the related parties which have not been (fully) applied yet -List invoices = delegator.findByAnd("Invoice", - UtilMisc.toMap("partyId", payment.getString("partyIdFrom"), "partyIdFrom", payment.getString("partyIdTo")), - UtilMisc.toList("invoiceDate")); +List invoices = delegator.findByAnd("Invoice", [partyId : payment.partyIdFrom, partyIdFrom : payment.partyIdTo], ["invoiceDate"]); -if (invoices != null && invoices.size() > 0) { - ArrayList invoicesList = new ArrayList(); // to pass back to the screeen list of unapplied invoices - BigDecimal paymentApplied = PaymentWorker.getPaymentAppliedBd(payment); - BigDecimal paymentToApply = payment.getBigDecimal("amount").setScale(decimals,rounding).subtract(paymentApplied); - Iterator p = invoices.iterator(); - while(p.hasNext()) { - invoice = p.next(); - BigDecimal invoiceAmount = InvoiceWorker.getInvoiceTotalBd(invoice).setScale(decimals,rounding); - BigDecimal invoiceApplied = InvoiceWorker.getInvoiceAppliedBd(invoice).setScale(decimals,rounding); +if (invoices) { + invoicesList = []; // to pass back to the screeen list of unapplied invoices + paymentApplied = PaymentWorker.getPaymentAppliedBd(payment); + paymentToApply = payment.getBigDecimal("amount").setScale(decimals,rounding).subtract(paymentApplied); + invoices.each { invoice -> + invoiceAmount = InvoiceWorker.getInvoiceTotalBd(invoice).setScale(decimals,rounding); + invoiceApplied = InvoiceWorker.getInvoiceAppliedBd(invoice).setScale(decimals,rounding); if (!invoiceAmount.equals(invoiceApplied) && - !invoice.getString("statusId").equals("INVOICE_CANCELLED") && - !invoice.getString("statusId").equals("INVOICE_IN_PROCESS")) { + !invoice.statusId.equals("INVOICE_CANCELLED") && + !invoice.statusId.equals("INVOICE_IN_PROCESS")) { // put in the map - BigDecimal invoiceToApply = invoiceAmount.subtract(invoiceApplied); - Map invoiceMap = new HashMap(); - invoiceMap.put("invoiceId",invoice.getString("invoiceId")); - invoiceMap.put("currencyUomId",invoice.getString("currencyUomId")); - invoiceMap.put("amount",invoiceAmount); - invoiceMap.put("description",invoice.getString("description")); - invoiceMap.put("invoiceDate", invoice.getString("invoiceDate").substring(0,10)); // display only YYYY-MM-DD - invoiceMap.put("amountApplied", invoiceApplied); + invoiceToApply = invoiceAmount.subtract(invoiceApplied); + invoiceMap = [:]; + invoiceMap.invoiceId = invoice.invoiceId; + invoiceMap.currencyUomId = invoice.currencyUomId); + invoiceMap.amount = invoiceAmount; + invoiceMap.description = invoice.description; + invoiceMap.invoiceDate = invoice.invoiceDate.substring(0,10)); // display only YYYY-MM-DD + invoiceMap.amountApplied = invoiceApplied; if (paymentToApply.compareTo(invoiceToApply) < 0 ) { - invoiceMap.put("amountToApply",paymentToApply); - } - else { - invoiceMap.put("amountToApply",invoiceToApply); + invoiceMap.amountToApply = paymentToApply; + } else { + invoiceMap.amountToApply = invoiceToApply; } invoicesList.add(invoiceMap); } - } - context.put("invoices",invoicesList); + } + context.invoices = invoicesList; } - - Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.groovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/listNotAppliedPayments.groovy Sat May 31 16:53:49 2008 @@ -33,19 +33,18 @@ import java.text.NumberFormat; -basePaymentId = parameters.get("paymentId"); -basePayment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", basePaymentId)); +basePaymentId = parameters.paymentId; +basePayment = delegator.findByPrimaryKey("Payment", [paymentId : basePaymentId]); -int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); -int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); -Locale locale = context.get("locale"); +decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); +rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); -ArrayList paymentsMapList = new ArrayList(); // to pass back to the screeen list of unapplied payments +paymentsMapList = []; // to pass back to the screeen list of unapplied payments // retrieve payments for the related parties which have not been (fully) applied yet List payments = null; GenericValue payment = null; -exprList = new ArrayList(); +exprList = []; expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, basePayment.getString("partyIdFrom")); exprList.add(expr); expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, basePayment.getString("partyIdTo")); @@ -54,7 +53,7 @@ exprList.add(expr); // only payments with received and sent -exprListStatus = new ArrayList(); +exprListStatus = []; expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"); exprListStatus.add(expr); expr = EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_SENT"); @@ -64,33 +63,30 @@ topCond = EntityCondition.makeCondition(exprList, EntityOperator.AND); -payments = delegator.findList("Payment", topCond, null, UtilMisc.toList("effectiveDate"), null, false); - -if (payments != null && payments.size() > 0) { - BigDecimal basePaymentApplied = PaymentWorker.getPaymentAppliedBd(basePayment); - BigDecimal basePaymentAmount = basePayment.getBigDecimal("amount"); - BigDecimal basePaymentToApply = basePaymentAmount.subtract(basePaymentApplied); - Iterator p = payments.iterator(); - while(p.hasNext()) { - payment = p.next(); +payments = delegator.findList("Payment", topCond, null, ["effectiveDate"], null, false); + +if (payments) { + basePaymentApplied = PaymentWorker.getPaymentAppliedBd(basePayment); + basePaymentAmount = basePayment.getBigDecimal("amount"); + basePaymentToApply = basePaymentAmount.subtract(basePaymentApplied); + payments.each { payment -> if (PaymentWorker.getPaymentNotAppliedBd(payment).signum() == 1) { // positiv not applied amount? // yes, put in the map - Map paymentMap = new HashMap(); - paymentMap.put("paymentId", basePaymentId); - paymentMap.put("toPaymentId", payment.getString("paymentId")); - paymentMap.put("currencyUomId", payment.getString("currencyUomId")); - paymentMap.put("effectiveDate", payment.getString("effectiveDate").substring(0,10)); // list as YYYY-MM-DD - paymentMap.put("amount", payment.getBigDecimal("amount")); - paymentMap.put("amountApplied", PaymentWorker.getPaymentAppliedBd(payment)); - BigDecimal paymentToApply = PaymentWorker.getPaymentNotAppliedBd(payment); + paymentMap = [:]; + paymentMap.paymentId = basePaymentId; + paymentMap.toPaymentId = payment.paymentId; + paymentMap.currencyUomId = payment.currencyUomId; + paymentMap.effectiveDate = payment.effectiveDate.substring(0,10)); // list as YYYY-MM-DD + paymentMap.amount = payment.getBigDecimal("amount")); + paymentMap.amountApplied = PaymentWorker.getPaymentAppliedBd(payment)); + paymentToApply = PaymentWorker.getPaymentNotAppliedBd(payment); if (paymentToApply.compareTo(basePaymentToApply) < 0 ) { - paymentMap.put("amountToApply",paymentToApply); - } - else { - paymentMap.put("amountToApply",basePaymentToApply); + paymentMap.amountToApply = paymentToApply; + } else { + paymentMap.amountToApply = basePaymentToApply; } paymentsMapList.add(paymentMap); } } -} -context.put("payments", paymentsMapList); +} +context.payments = paymentsMapList; Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.groovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/manualTx.groovy Sat May 31 16:53:49 2008 @@ -20,69 +20,69 @@ import org.ofbiz.base.util.*; // stores -productStores = delegator.findList("ProductStore", null, null, UtilMisc.toList("storeName"), null, true); -context.put("productStores", productStores); +productStores = delegator.findList("ProductStore", null, null, ["storeName"], null, true); +context.productStores = productStores; // current store -productStoreId = parameters.get("productStoreId"); -if (productStoreId != null) { - productStore = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", productStoreId)); - context.put("currentStore", productStore); +productStoreId = parameters.productStoreId; +if (productStoreId) { + productStore = delegator.findByPrimaryKey("ProductStore", [productStoreId : productStoreId]); + context.currentStore = productStore; } // payment settings -paymentSettings = delegator.findByAnd("Enumeration", UtilMisc.toMap("enumTypeId", "PRDS_PAYSVC"), UtilMisc.toList("sequenceId")); -context.put("paymentSettings", paymentSettings); +paymentSettings = delegator.findByAnd("Enumeration", [enumTypeId : "PRDS_PAYSVC"], ["sequenceId"]); +context.paymentSettings = paymentSettings; // payment method (for auto-fill) -paymentMethodId = parameters.get("paymentMethodId"); -context.put("paymentMethodId", paymentMethodId); +paymentMethodId = parameters.paymentMethodId; +context.paymentMethodId = paymentMethodId; // payment method type -paymentMethodTypeId = parameters.get("paymentMethodTypeId"); -context.put("paymentMethodTypeId", paymentMethodTypeId); +paymentMethodTypeId = parameters.paymentMethodTypeId; +context.paymentMethodTypeId = paymentMethodTypeId; // service type (transaction type) -txType = parameters.get("transactionType"); -context.put("txType", txType); -if (txType != null) { - currentTx = delegator.findByPrimaryKey("Enumeration", UtilMisc.toMap("enumId", txType)); - context.put("currentTx", currentTx); +txType = parameters.transactionType; +context.txType = txType; +if (txType) { + currentTx = delegator.findByPrimaryKey("Enumeration", [enumId : txType]); + context.currentTx = currentTx; } -if (paymentMethodId != null) { - paymentMethod = delegator.findByPrimaryKey("PaymentMethod", UtilMisc.toMap("paymentMethodId", paymentMethodId)); - if (paymentMethod != null) { +if (paymentMethodId) { + paymentMethod = delegator.findByPrimaryKey("PaymentMethod", [paymentMethodId : paymentMethodId]); + if (paymentMethod) { // payment method type - paymentMethodTypeId = paymentMethod.getString("paymentMethodTypeId"); + paymentMethodTypeId = paymentMethod.paymentMethodTypeId; // party information party = paymentMethod.getRelatedOne("Party"); - if (party != null && "PERSON".equals(party.getString("partyTypeId"))) { + if (party && "PERSON".equals(party.partyTypeId)) { person = party.getRelatedOne("Person"); - context.put("person", person); - } else if (party != null && "PARTY_GROUP".equals(party.getString("partyTypeId"))) { + context.person = person; + } else if (party && "PARTY_GROUP".equals(party.partyTypeId)) { partyGroup = party.getRelatedOne("PartyGroup"); - context.put("partyGroup", partyGroup); + context.partyGroup = partyGroup; } // method info + address creditCard = paymentMethod.getRelatedOne("CreditCard"); context.put("creditCard", creditCard); - if (creditCard != null) { + if (creditCard) { postalAddress = creditCard.getRelatedOne("PostalAddress"); - context.put("postalFields", postalAddress); + context.postalFields = postalAddress; } giftCard = paymentMethod.getRelatedOne("GiftCard"); - context.put("giftCard", giftCard); + context.giftCard = giftCard; // todo add support for eft account } } -if (paymentMethodTypeId != null) { - paymentMethodType = delegator.findByPrimaryKey("PaymentMethodType", UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId)); - context.put("paymentMethodType", paymentMethodType); - context.put("paymentMethodTypeId", paymentMethodTypeId); +if (paymentMethodTypeId) { + paymentMethodType = delegator.findByPrimaryKey("PaymentMethodType", [paymentMethodTypeId : paymentMethodTypeId]); + context.paymentMethodType = paymentMethodType; + context.paymentMethodTypeId = paymentMethodTypeId; } Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.groovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/payment/printChecks.groovy Sat May 31 16:53:49 2008 @@ -23,39 +23,37 @@ import org.ofbiz.base.util.UtilNumber; // rounding mode -int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); -int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); -context.put("decimals", decimals); -context.put("rounding", rounding); +decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); +rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); +context.decimals = decimals; +context.rounding = rounding; // list of payments -payments = new ArrayList(); +payments = []; // first ensure ability to print security = request.getAttribute("security"); context.put("security", security); if (!security.hasEntityPermission("ACCOUNTING", "_PRINT_CHECKS", session)) { - context.put("payments", payments); // if no permission, just pass an empty list for now + context.payments = payments; // if no permission, just pass an empty list for now return; } // in the case of a single payment, the paymentId will be supplied -paymentId = context.get("paymentId"); -if (paymentId != null) { - payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); - if (payment != null) payments.add(payment); - context.put("payments", payments); +paymentId = context.paymentId; +if (paymentId) { + payment = delegator.findByPrimaryKey("Payment", [paymentId : paymentId]); + if (payment) payments.add(payment); + context.payments = payments; return; } // in the case of a multi form, parse the multi data and get all of the selected payments selected = UtilHttp.parseMultiFormData(parameters); -iter = selected.iterator(); -while (iter.hasNext()) { - row = iter.next(); - payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", row.get("paymentId"))); - if (payment == null) continue; +selected.each { row -> + payment = delegator.findByPrimaryKey("Payment", [paymentId : row.paymentId]); + if (!payment) continue; payments.add(payment); } -context.put("payments", payments); +context.payments = payments; Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy (from r661672, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.bsh&r1=661672&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/SalesInvoiceByProductCategorySummary.groovy Sat May 31 16:53:49 2008 @@ -31,8 +31,8 @@ //TODO: // get products and categories under the root category -productMemberList = delegator.findByAnd("ProductCategoryMember", UtilMisc.toMap("productCategoryId", rootProductCategoryId), UtilMisc.toList("sequenceNum")); -categoryRollupList = delegator.findByAnd("ProductCategoryRollup", UtilMisc.toMap("parentProductCategoryId", rootProductCategoryId), UtilMisc.toList("sequenceNum")); +productMemberList = delegator.findByAnd("ProductCategoryMember", [productCategoryId : rootProductCategoryId], ["sequenceNum"]); +categoryRollupList = delegator.findByAnd("ProductCategoryRollup", [parentProductCategoryId : rootProductCategoryId], ["sequenceNum"]); // for use in the queries productIdSet = FastSet.newInstance(); @@ -42,21 +42,17 @@ productList = FastList.newInstance(); productCategoryList = FastList.newInstance(); -productMemberIter = productMemberList.iterator(); -while (productMemberIter.hasNext()) { - productMember = productMemberIter.next(); - if (!productIdSet.contains(productMember.get("productId"))) { +productMemberList.each { productMember -> + if (!productIdSet.contains(productMember.productId)) { productList.add(productMember.getRelatedOneCache("Product")); } - productIdSet.add(productMember.get("productId")); + productIdSet.add(productMember.productId); } -categoryRollupIter = categoryRollupList.iterator(); -while (categoryRollupIter.hasNext()) { - categoryRollup = categoryRollupIter.next(); - if (!productCategoryIdSet.contains(categoryRollup.get("productCategoryId"))) { +categoryRollupList.each { categoryRollup -> + if (!productCategoryIdSet.contains(categoryRollup.productCategoryId)) { productCategoryList.add(categoryRollup.getRelatedOneCache("CurrentProductCategory")); } - productCategoryIdSet.add(categoryRollup.get("productCategoryId")); + productCategoryIdSet.add(categoryRollup.productCategoryId); } productFieldsToSelect = UtilMisc.toSet("productId", "quantityTotal", "amountTotal"); @@ -64,27 +60,27 @@ //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")); -baseProductAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, UtilMisc.toList("INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"))); -baseProductAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, UtilMisc.toList("INVOICE_READY", "INVOICE_PAID"))); -if (UtilValidate.isNotEmpty(organizationPartyId)) baseProductAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId)); -if (UtilValidate.isNotEmpty(currencyUomId)) baseProductAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId)); +baseProductAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"])); +baseProductAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_READY", "INVOICE_PAID"])); +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, UtilMisc.toList("INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"))); -baseCategoryAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, UtilMisc.toList("INVOICE_READY", "INVOICE_PAID"))); -if (productCategoryIdSet.size() > 0) baseCategoryAndExprs.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.IN, productCategoryIdSet)); -if (productIdSet.size() > 0) baseCategoryAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.NOT_IN, productIdSet)); -if (UtilValidate.isNotEmpty(organizationPartyId)) baseCategoryAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId)); -if (UtilValidate.isNotEmpty(currencyUomId)) baseCategoryAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId)); +baseCategoryAndExprs.add(EntityCondition.makeCondition("invoiceItemTypeId", EntityOperator.IN, ["INV_PROD_ITEM", "INV_FPROD_ITEM", "INV_DPROD_ITEM"])); +baseCategoryAndExprs.add(EntityCondition.makeCondition("statusId", EntityOperator.IN, ["INVOICE_READY", "INVOICE_PAID"])); +if (productCategoryIdSet) baseCategoryAndExprs.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.IN, productCategoryIdSet)); +if (productIdSet) baseCategoryAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.NOT_IN, productIdSet)); +if (organizationPartyId) baseCategoryAndExprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, organizationPartyId)); +if (currencyUomId) baseCategoryAndExprs.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, currencyUomId)); // get the Calendar object for the current month (specifed by month, year Integer values in the context) monthCal = Calendar.getInstance(); -monthCal.set(Calendar.YEAR, year.intValue()); -monthCal.set(Calendar.MONTH, (month.intValue() - 1)); +monthCal.set(Calendar.YEAR, year); +monthCal.set(Calendar.MONTH, (month - 1)); nextMonthCal = Calendar.getInstance(); nextMonthCal.setTimeInMillis(monthCal.getTimeInMillis()); @@ -113,15 +109,15 @@ // do the product find productAndExprs = FastList.newInstance(); productAndExprs.addAll(baseProductAndExprs); - if (productIdSet.size() > 0) productAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.IN, productIdSet)); + if (productIdSet) productAndExprs.add(EntityCondition.makeCondition("productId", EntityOperator.IN, productIdSet)); 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); productResultMap = FastMap.newInstance(); - while ((productResult = productResultListIterator.next()) != null) { - productResultMap.put(productResult.get("productId"), productResult); - monthProductResult = UtilMisc.getMapFromMap(monthProductResultMap, productResult.get("productId")); + while ((productResult = productResultListIterator.next())) { + productResultMap[productResult.productId] = productResult; + monthProductResult = UtilMisc.getMapFromMap(monthProductResultMap, productResult.productId); UtilMisc.addToBigDecimalInMap(monthProductResult, "quantityTotal", productResult.getBigDecimal("quantityTotal")); UtilMisc.addToBigDecimalInMap(monthProductResult, "amountTotal", productResult.getBigDecimal("amountTotal")); } @@ -136,9 +132,9 @@ categoryResultListIterator = delegator.find("InvoiceItemCategorySummary", EntityCondition.makeCondition(categoryAndExprs, EntityOperator.AND), null, categoryFieldsToSelect, null, findOpts); categoryResultMap = FastMap.newInstance(); - while ((categoryResult = categoryResultListIterator.next()) != null) { - categoryResultMap.put(categoryResult.get("productCategoryId"), categoryResult); - monthCategoryResult = UtilMisc.getMapFromMap(monthCategoryResultMap, categoryResult.get("productCategoryId")); + while ((categoryResult = categoryResultListIterator.next())) { + categoryResultMap[categoryResult.productCategoryId] = categoryResult; + monthCategoryResult = UtilMisc.getMapFromMap(monthCategoryResultMap, categoryResult.productCategoryId); UtilMisc.addToBigDecimalInMap(monthCategoryResult, "quantityTotal", categoryResult.getBigDecimal("quantityTotal")); UtilMisc.addToBigDecimalInMap(monthCategoryResult, "amountTotal", categoryResult.getBigDecimal("amountTotal")); } @@ -155,7 +151,7 @@ // should just be 1 result productNullResult = productNullResultListIterator.next(); productNullResultListIterator.close(); - if (productNullResult != null) { + if (productNullResult) { productNullResultByDayList.add(productNullResult); UtilMisc.addToBigDecimalInMap(monthProductNullResult, "quantityTotal", productNullResult.getBigDecimal("quantityTotal")); UtilMisc.addToBigDecimalInMap(monthProductNullResult, "amountTotal", productNullResult.getBigDecimal("amountTotal")); @@ -165,14 +161,14 @@ } } -context.put("productResultMapByDayList", productResultMapByDayList); -context.put("productNullResultByDayList", productResultMapByDayList); -context.put("categoryResultMapByDayList", categoryResultMapByDayList); - -context.put("monthProductResultMap", monthProductResultMap); -context.put("monthCategoryResultMap", monthCategoryResultMap); -context.put("monthProductNullResult", monthProductNullResult); +context.productResultMapByDayList = productResultMapByDayList; +context.productNullResultByDayList = productNullResultMapByDayList; +context.categoryResultMapByDayList = categoryResultMapByDayList; + +context.monthProductResultMap = monthProductResultMap; +context.monthCategoryResultMap = monthCategoryResultMap; +context.monthProductNullResult = monthProductNullResult; -context.put("productCategoryList", productCategoryList); -context.put("productList", productList); +context.productCategoryList = productCategoryList; +context.productList = productList; \ No newline at end of file Copied: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy (from r661962, ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy?p2=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy&p1=ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh&r1=661962&r2=662107&rev=662107&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.bsh (original) +++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy Sat May 31 16:53:49 2008 @@ -28,58 +28,54 @@ import javolution.util.FastList; import javolution.util.FastMap; -exprs = UtilMisc.toList(EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId)); -if (UtilValidate.isNotEmpty(fromDate)) { +exprs = [EntityCondition.makeCondition("organizationPartyId", EntityOperator.EQUALS, organizationPartyId)]; +if (fromDate) { exprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); } -if (UtilValidate.isNotEmpty(thruDate)) { +if (thruDate) { exprs.add(EntityCondition.makeCondition("transactionDate", EntityOperator.LESS_THAN_EQUAL_TO, thruDate)); } -List postedExprs = FastList.newInstance(); +postedExprs = FastList.newInstance(); postedExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "Y")); postedExprs.addAll(exprs); -fieldsToSelect = UtilMisc.toSet("glAccountId", "debitCreditFlag", "totalAmount"); -orderBy = UtilMisc.toList("glAccountId"); +fieldsToSelect = ["glAccountId", "debitCreditFlag", "totalAmount"] as Set; +orderBy = ["glAccountId"]; -List postedTransTotalList = FastList.newInstance(); -List postedTrans = delegator.findList("GlAccOrgAndAcctgTransAndEntry", EntityCondition.makeCondition(postedExprs, EntityOperator.AND), fieldsToSelect, orderBy, null, false); -if (UtilValidate.isNotEmpty(postedTrans)) { - iter = postedTrans.iterator(); - while (iter.hasNext()) { - Map postedMap = FastMap.newInstance(); - GenericValue value = iter.next(); - postedMap.put("glAccountId", value.getString("glAccountId")); - if ("C".equals(value.getString("debitCreditFlag"))) { - postedMap.put("credit", value.getDouble("totalAmount")); - postedMap.put("debit", new Double(0.0)); +postedTransTotalList = FastList.newInstance(); +postedTrans = delegator.findList("GlAccOrgAndAcctgTransAndEntry", EntityCondition.makeCondition(postedExprs, EntityOperator.AND), fieldsToSelect, orderBy, null, false); +if (postedTrans) { + postedTrans.each { value -> + postedMap = FastMap.newInstance(); + postedMap.glAccountId = value.glAccountId; + if ("C".equals(value.debitCreditFlag)) { + postedMap.credit = value.getDouble("totalAmount"); + postedMap.debit = new Double(0.0); } else { - postedMap.put("credit", new Double(0.0)); - postedMap.put("debit", value.getDouble("totalAmount")); + postedMap.credit = new Double(0.0); + postedMap.debit = value.getDouble("totalAmount"); } postedTransTotalList.add(postedMap); } } -context.put("postedTransTotalList", postedTransTotalList); +context.postedTransTotalList = postedTransTotalList; -List unpostedExprs = FastList.newInstance(); +unpostedExprs = FastList.newInstance(); unpostedExprs.add(EntityCondition.makeCondition("isPosted", EntityOperator.EQUALS, "N")); unpostedExprs.addAll(exprs); -List unpostedTransTotalList = FastList.newInstance(); -List unpostedTrans = delegator.findList("GlAccOrgAndAcctgTransAndEntry", EntityCondition.makeCondition(unpostedExprs, EntityOperator.AND), fieldsToSelect, orderBy, null, false); -if (UtilValidate.isNotEmpty(unpostedTrans)) { - iter = unpostedTrans.iterator(); - while (iter.hasNext()) { +unpostedTransTotalList = FastList.newInstance(); +unpostedTrans = delegator.findList("GlAccOrgAndAcctgTransAndEntry", EntityCondition.makeCondition(unpostedExprs, EntityOperator.AND), fieldsToSelect, orderBy, null, false); +if (unpostedTrans) { + unpostedTrans.each { value -> Map unpostedMap = FastMap.newInstance(); - GenericValue value = iter.next(); - unpostedMap.put("glAccountId", value.getString("glAccountId")); - if ("C".equals(value.getString("debitCreditFlag"))) { - unpostedMap.put("credit", value.getDouble("totalAmount")); - unpostedMap.put("debit", new Double(0.0)); + unpostedMap.glAccountId = value.glAccountId; + if ("C".equals(value.debitCreditFlag)) { + unpostedMap.credit = value.getDouble("totalAmount"); + unpostedMap.debit = new Double(0.0); } else { - unpostedMap.put("credit", new Double(0.0)); - unpostedMap.put("debit", value.getDouble("totalAmount")); + unpostedMap.credit = new Double(0.0); + unpostedMap.debit = value.getDouble("totalAmount"); } unpostedTransTotalList.add(unpostedMap); } Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/reports/TransactionTotals.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain |
Free forum by Nabble | Edit this page |