Modified: ofbiz/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy Wed Nov 2 19:09:13 2016 @@ -21,201 +21,201 @@ // parameters or use orderId, invoiceId, or returnId to look them up. // if none of these parameters are available then fromPartyId is used or "ORGANIZATION_PARTY" from general.properties as fallback -import java.sql.Timestamp; +import java.sql.Timestamp -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.order.order.OrderReadHelper; -import org.apache.ofbiz.party.content.PartyContentWrapper; -import org.apache.ofbiz.entity.util.EntityUtilProperties; - -orderHeader = parameters.orderHeader; -orderId = parameters.orderId; -invoice = parameters.invoice; -invoiceId = parameters.invoiceId; -shipmentId = parameters.shipmentId; -returnHeader = parameters.returnHeader; -returnId = parameters.returnId; -quote = null; -quoteId = parameters.quoteId; -fromPartyId = parameters.fromPartyId; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.order.order.OrderReadHelper +import org.apache.ofbiz.party.content.PartyContentWrapper +import org.apache.ofbiz.entity.util.EntityUtilProperties + +orderHeader = parameters.orderHeader +orderId = parameters.orderId +invoice = parameters.invoice +invoiceId = parameters.invoiceId +shipmentId = parameters.shipmentId +returnHeader = parameters.returnHeader +returnId = parameters.returnId +quote = null +quoteId = parameters.quoteId +fromPartyId = parameters.fromPartyId if (!orderHeader && orderId) { - orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne() try { if (parameters.facilityId) { - UtilHttp.setContentDisposition(response, "PickSheet" + orderId + ".pdf"); + UtilHttp.setContentDisposition(response, "PickSheet" + orderId + ".pdf") } else { - UtilHttp.setContentDisposition(response, orderId + ".pdf"); + UtilHttp.setContentDisposition(response, orderId + ".pdf") } } catch (MissingPropertyException e) { // This hack for OFBIZ-6792 to avoid "groovy.lang.MissingPropertyException: No such property: response for class: CompanyHeader" when response does not exist (in sendOrderConfirmation service) } } else if (shipmentId) { - shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); - orderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false); + shipment = from("Shipment").where("shipmentId", shipmentId).queryOne() + orderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false) } if (!invoice && invoiceId) { - invoice = from("Invoice").where("invoiceId", invoiceId).queryOne(); + invoice = from("Invoice").where("invoiceId", invoiceId).queryOne() try { - UtilHttp.setContentDisposition(response, invoiceId + ".pdf"); + UtilHttp.setContentDisposition(response, invoiceId + ".pdf") } catch (MissingPropertyException e) { // This hack for OFBIZ-6792 to avoid "groovy.lang.MissingPropertyException: No such property: response for class: CompanyHeader" when response does not exist (in sendOrderConfirmation service) } } if (!returnHeader && returnId) { - returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne(); + returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne() } if (quoteId) { - quote = from("Quote").where("quoteId", quoteId).queryOne(); + quote = from("Quote").where("quoteId", quoteId).queryOne() } // defaults: -def logoImageUrl = null; // the default value, "/images/ofbiz_powered.gif", is set in the screen decorators -def partyId = null; +def logoImageUrl = null // the default value, "/images/ofbiz_powered.gif", is set in the screen decorators +def partyId = null // get the logo partyId from order or invoice - note that it is better to do comparisons this way in case the there are null values if (orderHeader) { - orh = new OrderReadHelper(orderHeader); + orh = new OrderReadHelper(orderHeader) // for sales order, the logo party is the "BILL_FROM_VENDOR" of the order. If that's not available, we'll use the OrderHeader's ProductStore's payToPartyId if ("SALES_ORDER".equals(orderHeader.orderTypeId)) { if (orh.getBillFromParty()) { - partyId = orh.getBillFromParty().partyId; + partyId = orh.getBillFromParty().partyId } else { - productStore = orderHeader.getRelatedOne("ProductStore", false); + productStore = orderHeader.getRelatedOne("ProductStore", false) if (orderHeader.orderTypeId.equals("SALES_ORDER") && productStore?.payToPartyId) { - partyId = productStore.payToPartyId; + partyId = productStore.payToPartyId } } // purchase orders - use the BILL_TO_CUSTOMER of the order } else if ("PURCHASE_ORDER".equals(orderHeader.orderTypeId)) { - def billToParty = orh.getBillToParty(); + def billToParty = orh.getBillToParty() if (billToParty) { - partyId = billToParty.partyId; + partyId = billToParty.partyId } else { - def billToCustomer = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", [roleTypeId : "BILL_TO_CUSTOMER"], null, false)); + def billToCustomer = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", [roleTypeId : "BILL_TO_CUSTOMER"], null, false)) if (billToCustomer) { - partyId = billToCustomer.partyId; + partyId = billToCustomer.partyId } } } } else if (invoice) { if ("SALES_INVOICE".equals(invoice.invoiceTypeId) && invoice.partyIdFrom) { - partyId = invoice.partyIdFrom; + partyId = invoice.partyIdFrom } if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId) || "CUST_RTN_INVOICE".equals(invoice.invoiceTypeId) && invoice.partyId) { - partyId = invoice.partyId; + partyId = invoice.partyId } } else if (returnHeader) { if ("CUSTOMER_RETURN".equals(returnHeader.returnHeaderTypeId) && returnHeader.toPartyId) { - partyId = returnHeader.toPartyId; + partyId = returnHeader.toPartyId } else if ("VENDOR_RETURN".equals(returnHeader.returnHeaderTypeId) && returnHeader.fromPartyId) { - partyId = returnHeader.fromPartyId; + partyId = returnHeader.fromPartyId } } else if (quote) { - productStore = quote.getRelatedOne("ProductStore", false); + productStore = quote.getRelatedOne("ProductStore", false) if (productStore?.payToPartyId) { - partyId = productStore.payToPartyId; + partyId = productStore.payToPartyId } } // if partyId wasn't found use fromPartyId-parameter if (!partyId) { if (fromPartyId) { - partyId = fromPartyId; + partyId = fromPartyId } else { - partyId = parameters.get('ApplicationDecorator|organizationPartyId') ? parameters.get('ApplicationDecorator|organizationPartyId') : context.defaultOrganizationPartyId; + partyId = parameters.get('ApplicationDecorator|organizationPartyId') ? parameters.get('ApplicationDecorator|organizationPartyId') : context.defaultOrganizationPartyId } } // the logo -partyGroup = from("PartyGroup").where("partyId", partyId).queryOne(); +partyGroup = from("PartyGroup").where("partyId", partyId).queryOne() if (partyGroup) { - partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)); - partyContent = partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, "LGOIMGURL", delegator); + partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", "text/html; charset=utf-8", delegator)) + partyContent = partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, "LGOIMGURL", delegator) if (partyContent) { - logoImageUrl = "/content/control/stream?contentId=" + partyContent.contentId; + logoImageUrl = "/content/control/stream?contentId=" + partyContent.contentId } else { if (partyGroup?.logoImageUrl) { - logoImageUrl = partyGroup.logoImageUrl; + logoImageUrl = partyGroup.logoImageUrl } } } //If logoImageUrl not null then only set it to context else it will override the default value "/images/ofbiz_powered.gif" if (logoImageUrl) { - context.logoImageUrl = logoImageUrl; + context.logoImageUrl = logoImageUrl } // the company name -companyName = "Default Company"; +companyName = "Default Company" if (partyGroup?.groupName) { - companyName = partyGroup.groupName; + companyName = partyGroup.groupName } -context.companyName = companyName; +context.companyName = companyName // the address addresses = from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechPurposeTypeId", "GENERAL_LOCATION") .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") - .queryList(); -address = null; + .queryList() +address = null if (addresses) { - address = from("PostalAddress").where("contactMechId", addresses[0].contactMechId).queryOne(); + address = from("PostalAddress").where("contactMechId", addresses[0].contactMechId).queryOne() } if (address) { // get the country name and state/province abbreviation - country = address.getRelatedOne("CountryGeo", true); + country = address.getRelatedOne("CountryGeo", true) if (country) { - context.countryName = country.get("geoName", locale); + context.countryName = country.get("geoName", locale) } - stateProvince = address.getRelatedOne("StateProvinceGeo", true); + stateProvince = address.getRelatedOne("StateProvinceGeo", true) if (stateProvince) { - context.stateProvinceAbbr = stateProvince.abbreviation; + context.stateProvinceAbbr = stateProvince.abbreviation } } -context.postalAddress = address; +context.postalAddress = address //telephone phones = from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_PHONE") .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") - .queryList(); + .queryList() if (phones) { - context.phone = from("TelecomNumber").where("contactMechId", phones[0].contactMechId).queryOne(); + context.phone = from("TelecomNumber").where("contactMechId", phones[0].contactMechId).queryOne() } // Fax faxNumbers = from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechPurposeTypeId", "FAX_NUMBER") .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") - .queryList(); + .queryList() if (faxNumbers) { - context.fax = from("TelecomNumber").where("contactMechId", faxNumbers[0].contactMechId).queryOne(); + context.fax = from("TelecomNumber").where("contactMechId", faxNumbers[0].contactMechId).queryOne() } emails = from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL") .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") - .queryList(); + .queryList() if (emails) { - context.email = from("ContactMech").where("contactMechId", emails[0].contactMechId).queryOne(); + context.email = from("ContactMech").where("contactMechId", emails[0].contactMechId).queryOne() } else { //get email address from party contact mech selContacts = from("PartyContactMech") .where("partyId", partyId).filterByDate(nowTimestamp, "fromDate", "thruDate") - .queryList(); + .queryList() if (selContacts) { - i = selContacts.iterator(); + i = selContacts.iterator() while (i.hasNext()) { - email = i.next().getRelatedOne("ContactMech", false); + email = i.next().getRelatedOne("ContactMech", false) if ("ELECTRONIC_ADDRESS".equals(email.contactMechTypeId)) { - context.email = email; - break; + context.email = email + break } } } @@ -225,22 +225,22 @@ if (emails) { websiteUrls = from("PartyContactWithPurpose") .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_WEB_URL") .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") - .queryList(); + .queryList() if (websiteUrls) { - websiteUrl = EntityUtil.getFirst(websiteUrls); - context.website = from("ContactMech").where("contactMechId", websiteUrl.contactMechId).queryOne(); + websiteUrl = EntityUtil.getFirst(websiteUrls) + context.website = from("ContactMech").where("contactMechId", websiteUrl.contactMechId).queryOne() } else { //get web address from party contact mech selContacts = from("PartyContactMech") .where("partyId", partyId) .filterByDate(nowTimestamp, "fromDate", "thruDate") - .queryList(); + .queryList() if (selContacts) { - Iterator i = selContacts.iterator(); + Iterator i = selContacts.iterator() while (i.hasNext()) { - website = i.next().getRelatedOne("ContactMech", false); + website = i.next().getRelatedOne("ContactMech", false) if ("WEB_ADDRESS".equals(website.contactMechTypeId)) { - context.website = website; - break; + context.website = website + break } } } @@ -250,26 +250,26 @@ if (websiteUrls) { selPayments = from("PaymentMethod") .where("partyId", partyId, "paymentMethodTypeId", "EFT_ACCOUNT") .filterByDate(nowTimestamp, "fromDate", "thruDate") - .queryList(); + .queryList() if (selPayments) { - context.eftAccount = from("EftAccount").where("paymentMethodId", selPayments[0].paymentMethodId).queryOne(); + context.eftAccount = from("EftAccount").where("paymentMethodId", selPayments[0].paymentMethodId).queryOne() } // Tax ID Info partyTaxAuthInfoList = from("PartyTaxAuthInfo").where("partyId", partyId) .filterByDate(nowTimestamp, "fromDate", "thruDate") - .queryList(); + .queryList() if (partyTaxAuthInfoList) { if (address?.countryGeoId) { // if we have an address with country filter by that partyTaxAuthInfoList.eachWithIndex { partyTaxAuthInfo, i -> if (partyTaxAuthInfo.taxAuthGeoId.equals(address.countryGeoId)) { - context.sendingPartyTaxId = partyTaxAuthInfo.partyTaxId; + context.sendingPartyTaxId = partyTaxAuthInfo.partyTaxId } } } else { // otherwise just grab the first one - context.sendingPartyTaxId = partyTaxAuthInfoList[0].partyTaxId; + context.sendingPartyTaxId = partyTaxAuthInfoList[0].partyTaxId } } Modified: ofbiz/trunk/applications/order/groovyScripts/order/FilterOrderList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/FilterOrderList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/FilterOrderList.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/FilterOrderList.groovy Wed Nov 2 19:09:13 2016 @@ -17,70 +17,70 @@ * under the License. */ -import java.math.BigDecimal; -import org.apache.ofbiz.base.util.UtilValidate; -import org.apache.ofbiz.entity.GenericValue; -import org.apache.ofbiz.order.order.OrderReadHelper; -import org.apache.ofbiz.product.store.ProductStoreWorker; -import org.apache.ofbiz.order.order.OrderListState; +import java.math.BigDecimal +import org.apache.ofbiz.base.util.UtilValidate +import org.apache.ofbiz.entity.GenericValue +import org.apache.ofbiz.order.order.OrderReadHelper +import org.apache.ofbiz.product.store.ProductStoreWorker +import org.apache.ofbiz.order.order.OrderListState -orderHeaderList = context.orderHeaderList; -productStore = ProductStoreWorker.getProductStore(request); +orderHeaderList = context.orderHeaderList +productStore = ProductStoreWorker.getProductStore(request) -filterInventoryProblems = []; +filterInventoryProblems = [] if (state.hasFilter("filterInventoryProblems") && orderHeaderList) { orderHeaderList.each { orderHeader -> - orderReadHelper = OrderReadHelper.getHelper(orderHeader); - backorderQty = orderReadHelper.getOrderBackorderQuantity(); + orderReadHelper = OrderReadHelper.getHelper(orderHeader) + backorderQty = orderReadHelper.getOrderBackorderQuantity() if (backorderQty.compareTo(BigDecimal.ZERO) > 0) { - filterInventoryProblems.add(orderHeader.orderId); + filterInventoryProblems.add(orderHeader.orderId) } } } -filterPOsOpenPastTheirETA = []; -filterPOsWithRejectedItems = []; -filterPartiallyReceivedPOs = []; +filterPOsOpenPastTheirETA = [] +filterPOsWithRejectedItems = [] +filterPartiallyReceivedPOs = [] -state = OrderListState.getInstance(request); +state = OrderListState.getInstance(request) if ((state.hasFilter("filterPartiallyReceivedPOs") || state.hasFilter("filterPOsOpenPastTheirETA") || state.hasFilter("filterPOsWithRejectedItems")) && orderHeaderList) { orderHeaderList.each { orderHeader -> - orderReadHelper = OrderReadHelper.getHelper(orderHeader); + orderReadHelper = OrderReadHelper.getHelper(orderHeader) if ("PURCHASE_ORDER".equals(orderHeader.orderTypeId)) { if (orderReadHelper.getRejectedOrderItems() && state.hasFilter("filterPOsWithRejectedItems")) { - filterPOsWithRejectedItems.add(orderHeader.get("orderId")); + filterPOsWithRejectedItems.add(orderHeader.get("orderId")) } else if (orderReadHelper.getPastEtaOrderItems(orderHeader.get("orderId")) && state.hasFilter("filterPOsOpenPastTheirETA")) { - filterPOsOpenPastTheirETA.add(orderHeader.orderId); + filterPOsOpenPastTheirETA.add(orderHeader.orderId) } else if (orderReadHelper.getPartiallyReceivedItems() && state.hasFilter("filterPartiallyReceivedPOs")) { - filterPartiallyReceivedPOs.add(orderHeader.orderId); + filterPartiallyReceivedPOs.add(orderHeader.orderId) } } } } -filterAuthProblems = []; +filterAuthProblems = [] if (state.hasFilter("filterAuthProblems") && orderHeaderList) { orderHeaderList.each { orderHeader -> - orderReadHelper = OrderReadHelper.getHelper(orderHeader); - paymentPrefList = orderReadHelper.getPaymentPreferences(); + orderReadHelper = OrderReadHelper.getHelper(orderHeader) + paymentPrefList = orderReadHelper.getPaymentPreferences() paymentPrefList.each { paymentPref -> if ("PAYMENT_NOT_AUTH".equals(paymentPref.statusId)) { - filterAuthProblems.add(orderHeader.orderId); + filterAuthProblems.add(orderHeader.orderId) } } } } -context.filterInventoryProblems = filterInventoryProblems; -context.filterPOsWithRejectedItems = filterPOsWithRejectedItems; -context.filterPOsOpenPastTheirETA = filterPOsOpenPastTheirETA; -context.filterPartiallyReceivedPOs = filterPartiallyReceivedPOs; -context.filterAuthProblems = filterAuthProblems; +context.filterInventoryProblems = filterInventoryProblems +context.filterPOsWithRejectedItems = filterPOsWithRejectedItems +context.filterPOsOpenPastTheirETA = filterPOsOpenPastTheirETA +context.filterPartiallyReceivedPOs = filterPartiallyReceivedPOs +context.filterAuthProblems = filterAuthProblems Modified: ofbiz/trunk/applications/order/groovyScripts/order/FindOrders.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/FindOrders.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/FindOrders.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/FindOrders.groovy Wed Nov 2 19:09:13 2016 @@ -17,164 +17,164 @@ * under the License. */ -import java.util.*; -import java.sql.Timestamp; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.util.*; +import java.util.* +import java.sql.Timestamp +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.util.* -module = "FindOrders.groovy"; +module = "FindOrders.groovy" // get the order types -orderTypes = from("OrderType").orderBy("description").queryList(); -context.orderTypes = orderTypes; +orderTypes = from("OrderType").orderBy("description").queryList() +context.orderTypes = orderTypes // get the role types -roleTypes = from("RoleType").orderBy("description").queryList(); -context.roleTypes = roleTypes; +roleTypes = from("RoleType").orderBy("description").queryList() +context.roleTypes = roleTypes // get the order statuses -orderStatuses = from("StatusItem").where("statusTypeId", "ORDER_STATUS").orderBy("sequenceId", "description").queryList(); -context.orderStatuses = orderStatuses; +orderStatuses = from("StatusItem").where("statusTypeId", "ORDER_STATUS").orderBy("sequenceId", "description").queryList() +context.orderStatuses = orderStatuses // get websites -websites = from("WebSite").orderBy("siteName").queryList(); -context.webSites = websites; +websites = from("WebSite").orderBy("siteName").queryList() +context.webSites = websites // get the stores -stores = from("ProductStore").orderBy("storeName").queryList(); -context.productStores = stores; +stores = from("ProductStore").orderBy("storeName").queryList() +context.productStores = stores // get the channels -channels = from("Enumeration").where("enumTypeId", "ORDER_SALES_CHANNEL").orderBy("sequenceId").queryList(); -context.salesChannels = channels; +channels = from("Enumeration").where("enumTypeId", "ORDER_SALES_CHANNEL").orderBy("sequenceId").queryList() +context.salesChannels = channels // get the Shipping Methods -carrierShipmentMethods = from("CarrierShipmentMethod").queryList(); -context.carrierShipmentMethods = carrierShipmentMethods; +carrierShipmentMethods = from("CarrierShipmentMethod").queryList() +context.carrierShipmentMethods = carrierShipmentMethods // get the Payment Status -paymentStatusList = from("StatusItem").where("statusTypeId", "PAYMENT_PREF_STATUS").orderBy("description").queryList(); -context.paymentStatusList = paymentStatusList; +paymentStatusList = from("StatusItem").where("statusTypeId", "PAYMENT_PREF_STATUS").orderBy("description").queryList() +context.paymentStatusList = paymentStatusList // get the good identification types -goodIdentificationTypes = from("GoodIdentificationType").orderBy("goodIdentificationTypeId", "description").queryList(); -context.goodIdentificationTypes = goodIdentificationTypes; +goodIdentificationTypes = from("GoodIdentificationType").orderBy("goodIdentificationTypeId", "description").queryList() +context.goodIdentificationTypes = goodIdentificationTypes // current role type -currentRoleTypeId = request.getParameter("roleTypeId"); +currentRoleTypeId = request.getParameter("roleTypeId") if (currentRoleTypeId) { - currentRole = from("RoleType").where("roleTypeId", currentRoleTypeId).cache(true).queryOne(); - context.currentRole = currentRole; + currentRole = from("RoleType").where("roleTypeId", currentRoleTypeId).cache(true).queryOne() + context.currentRole = currentRole } // current selected type -currentTypeId = request.getParameter("orderTypeId"); +currentTypeId = request.getParameter("orderTypeId") if (currentTypeId) { - currentType = from("OrderType").where("orderTypeId", currentTypeId).cache(true).queryOne(); - context.currentType = currentType; + currentType = from("OrderType").where("orderTypeId", currentTypeId).cache(true).queryOne() + context.currentType = currentType } // current selected status -currentStatusIds = request.getParameter("orderStatusId"); -context.currentStatuses = currentStatusIds; +currentStatusIds = request.getParameter("orderStatusId") +context.currentStatuses = currentStatusIds // current website -currentWebSiteId = request.getParameter("orderWebSiteId"); +currentWebSiteId = request.getParameter("orderWebSiteId") if (currentWebSiteId) { - currentWebSite = from("WebSite").where("webSiteId", currentWebSiteId).cache(true).queryOne(); - context.currentWebSite = currentWebSite; + currentWebSite = from("WebSite").where("webSiteId", currentWebSiteId).cache(true).queryOne() + context.currentWebSite = currentWebSite } // current store -currentProductStoreId = request.getParameter("productStoreId"); +currentProductStoreId = request.getParameter("productStoreId") if (currentProductStoreId) { - currentProductStore = from("ProductStore").where("productStoreId", currentProductStoreId).cache(true).queryOne(); - context.currentProductStore = currentProductStore; + currentProductStore = from("ProductStore").where("productStoreId", currentProductStoreId).cache(true).queryOne() + context.currentProductStore = currentProductStore } // current Shipping Method -shipmentMethod = request.getParameter("shipmentMethod"); +shipmentMethod = request.getParameter("shipmentMethod") if (shipmentMethod) { - carrierPartyId = shipmentMethod.substring(0, shipmentMethod.indexOf("@")); - shipmentMethodTypeId = shipmentMethod.substring(shipmentMethod.indexOf("@")+1); + carrierPartyId = shipmentMethod.substring(0, shipmentMethod.indexOf("@")) + shipmentMethodTypeId = shipmentMethod.substring(shipmentMethod.indexOf("@")+1) if (carrierPartyId && shipmentMethodTypeId) { - currentCarrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", carrierPartyId, "shipmentMethodTypeId", shipmentMethodTypeId).queryFirst(); - context.currentCarrierShipmentMethod = currentCarrierShipmentMethod; + currentCarrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", carrierPartyId, "shipmentMethodTypeId", shipmentMethodTypeId).queryFirst() + context.currentCarrierShipmentMethod = currentCarrierShipmentMethod } } // current channel -currentSalesChannelId = request.getParameter("salesChannelEnumId"); +currentSalesChannelId = request.getParameter("salesChannelEnumId") if (currentSalesChannelId) { - currentSalesChannel = from("Enumeration").where("enumId", currentSalesChannelId).queryOne(); - context.currentSalesChannel = currentSalesChannel; + currentSalesChannel = from("Enumeration").where("enumId", currentSalesChannelId).queryOne() + context.currentSalesChannel = currentSalesChannel } // current good identification type -currentGoodIdentificationTypeId = request.getParameter("goodIdentificationTypeId"); +currentGoodIdentificationTypeId = request.getParameter("goodIdentificationTypeId") if (currentGoodIdentificationTypeId) { - currentGoodIdentificationType = from("GoodIdentificationType").where("goodIdentificationTypeId", currentGoodIdentificationTypeId).queryOne(); - context.currentGoodIdentificationType = currentGoodIdentificationType; + currentGoodIdentificationType = from("GoodIdentificationType").where("goodIdentificationTypeId", currentGoodIdentificationTypeId).queryOne() + context.currentGoodIdentificationType = currentGoodIdentificationType } // create the fromDate for calendar -fromCal = Calendar.getInstance(); -fromCal.setTime(new java.util.Date()); -fromCal.set(Calendar.DAY_OF_WEEK, fromCal.getActualMinimum(Calendar.DAY_OF_WEEK)); -fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)); -fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)); -fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)); -fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)); -fromTs = new Timestamp(fromCal.getTimeInMillis()); -fromStr = fromTs.toString(); -fromStr = fromStr.substring(0, fromStr.indexOf('.')); -context.fromDateStr = fromStr; +fromCal = Calendar.getInstance() +fromCal.setTime(new java.util.Date()) +fromCal.set(Calendar.DAY_OF_WEEK, fromCal.getActualMinimum(Calendar.DAY_OF_WEEK)) +fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)) +fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)) +fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)) +fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)) +fromTs = new Timestamp(fromCal.getTimeInMillis()) +fromStr = fromTs.toString() +fromStr = fromStr.substring(0, fromStr.indexOf('.')) +context.fromDateStr = fromStr // create the thruDate for calendar -toCal = Calendar.getInstance(); -toCal.setTime(new java.util.Date()); -toCal.set(Calendar.DAY_OF_WEEK, toCal.getActualMaximum(Calendar.DAY_OF_WEEK)); -toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)); -toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)); -toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)); -toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)); -toTs = new Timestamp(toCal.getTimeInMillis()); -toStr = toTs.toString(); -context.thruDateStr = toStr; +toCal = Calendar.getInstance() +toCal.setTime(new java.util.Date()) +toCal.set(Calendar.DAY_OF_WEEK, toCal.getActualMaximum(Calendar.DAY_OF_WEEK)) +toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)) +toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)) +toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)) +toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)) +toTs = new Timestamp(toCal.getTimeInMillis()) +toStr = toTs.toString() +context.thruDateStr = toStr // set the page parameters -viewIndex = request.getParameter("viewIndex") ? Integer.valueOf(request.getParameter("viewIndex")) : 1; -context.viewIndex = viewIndex; +viewIndex = request.getParameter("viewIndex") ? Integer.valueOf(request.getParameter("viewIndex")) : 1 +context.viewIndex = viewIndex viewSize = request.getParameter("viewSize") ? Integer.valueOf(request.getParameter("viewSize")) : - EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator); -context.viewSize = viewSize; + EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator) +context.viewSize = viewSize // get the lookup flag -lookupFlag = request.getParameter("lookupFlag"); +lookupFlag = request.getParameter("lookupFlag") // fields from the service call -paramList = request.getAttribute("paramList") ?: ""; -context.paramList = paramList; +paramList = request.getAttribute("paramList") ?: "" +context.paramList = paramList if (paramList) { - paramIds = paramList.split("&"); - context.paramIdList = Arrays.asList(paramIds); + paramIds = paramList.split("&") + context.paramIdList = Arrays.asList(paramIds) } -orderList = request.getAttribute("orderList"); -context.orderList = orderList; +orderList = request.getAttribute("orderList") +context.orderList = orderList -orderListSize = request.getAttribute("orderListSize"); -context.orderListSize = orderListSize; +orderListSize = request.getAttribute("orderListSize") +context.orderListSize = orderListSize -context.filterInventoryProblems = request.getAttribute("filterInventoryProblemsList"); -context.filterPOsWithRejectedItems = request.getAttribute("filterPOsWithRejectedItemsList"); -context.filterPOsOpenPastTheirETA = request.getAttribute("filterPOsOpenPastTheirETAList"); -context.filterPartiallyReceivedPOs = request.getAttribute("filterPartiallyReceivedPOsList"); +context.filterInventoryProblems = request.getAttribute("filterInventoryProblemsList") +context.filterPOsWithRejectedItems = request.getAttribute("filterPOsWithRejectedItemsList") +context.filterPOsOpenPastTheirETA = request.getAttribute("filterPOsOpenPastTheirETAList") +context.filterPartiallyReceivedPOs = request.getAttribute("filterPartiallyReceivedPOsList") -lowIndex = request.getAttribute("lowIndex"); -context.lowIndex = lowIndex; +lowIndex = request.getAttribute("lowIndex") +context.lowIndex = lowIndex -highIndex = request.getAttribute("highIndex"); -context.highIndex = highIndex; +highIndex = request.getAttribute("highIndex") +context.highIndex = highIndex Modified: ofbiz/trunk/applications/order/groovyScripts/order/NewNote.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/NewNote.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/NewNote.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/NewNote.groovy Wed Nov 2 19:09:13 2016 @@ -17,23 +17,23 @@ * under the License. */ -orderId = request.getParameter("orderId"); -context.orderId = orderId; +orderId = request.getParameter("orderId") +context.orderId = orderId -workEffortId = request.getParameter("workEffortId"); -partyId = request.getParameter("partyId"); -roleTypeId = request.getParameter("roleTypeId"); -fromDate = request.getParameter("fromDate"); +workEffortId = request.getParameter("workEffortId") +partyId = request.getParameter("partyId") +roleTypeId = request.getParameter("roleTypeId") +fromDate = request.getParameter("fromDate") -donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId; +donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId if (workEffortId) - donePage += "&workEffortId=" + workEffortId; + donePage += "&workEffortId=" + workEffortId if (partyId) - donePage += "&partyId=" + partyId; + donePage += "&partyId=" + partyId if (roleTypeId) - donePage += "&roleTypeId=" + roleTypeId; + donePage += "&roleTypeId=" + roleTypeId if (fromDate) - donePage += "&fromDate=" + fromDate; + donePage += "&fromDate=" + fromDate -context.donePage = donePage; +context.donePage = donePage Modified: ofbiz/trunk/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/OrderDeliveryScheduleInfo.groovy Wed Nov 2 19:09:13 2016 @@ -17,29 +17,29 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* -orderId = request.getParameter("orderId"); -orderTypeId = null; -orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); +orderId = request.getParameter("orderId") +orderTypeId = null +orderHeader = from("OrderHeader").where("orderId", orderId).queryOne() if (orderHeader) { - orderTypeId = orderHeader.orderTypeId; + orderTypeId = orderHeader.orderTypeId } //Determine whether a schedule has already been defined for this PO -schedule = from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne(); +schedule = from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne() // Determine whether the current user can VIEW the order -checkResult = runService('checkSupplierRelatedOrderPermission', [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]); -hasSupplierRelatedPermissionStr = checkResult.hasSupplierRelatedPermission; +checkResult = runService('checkSupplierRelatedOrderPermission', [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]) +hasSupplierRelatedPermissionStr = checkResult.hasSupplierRelatedPermission // Determine what the reuslt is, no result is FALSE -hasSupplierRelatedPermission = "true".equals(hasSupplierRelatedPermissionStr); +hasSupplierRelatedPermission = "true".equals(hasSupplierRelatedPermissionStr) -context.orderId = orderId; -context.orderItemSeqId = "_NA_"; -context.orderTypeId = orderTypeId; -context.orderHeader = orderHeader; -context.schedule = schedule; -context.hasPermission = hasSupplierRelatedPermission; \ No newline at end of file +context.orderId = orderId +context.orderItemSeqId = "_NA_" +context.orderTypeId = orderTypeId +context.orderHeader = orderHeader +context.schedule = schedule +context.hasPermission = hasSupplierRelatedPermission \ No newline at end of file Modified: ofbiz/trunk/applications/order/groovyScripts/order/OrderHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/OrderHistory.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/OrderHistory.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/OrderHistory.groovy Wed Nov 2 19:09:13 2016 @@ -17,114 +17,114 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator -orderId = parameters.orderId; -context.orderId = orderId; +orderId = parameters.orderId +context.orderId = orderId -orderHeader = null; +orderHeader = null if (orderId) { - orderHeader = from("OrderHeader").where(orderId : orderId).queryOne(); + orderHeader = from("OrderHeader").where(orderId : orderId).queryOne() } if (orderHeader) { shipmentMethodCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItemShipGroup"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "shipmentMethodTypeId"), - EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - shipmentMethodHistories = from("EntityAuditLog").where(shipmentMethodCond).orderBy("-changedDate").queryList(); + EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")] + shipmentMethodHistories = from("EntityAuditLog").where(shipmentMethodCond).orderBy("-changedDate").queryList() carrierPartyCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItemShipGroup"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "carrierPartyId"), - EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - carrierPartyHistories = from("EntityAuditLog").where(carrierPartyCond).queryList(); + EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")] + carrierPartyHistories = from("EntityAuditLog").where(carrierPartyCond).queryList() - orderShipmentHistories = []; + orderShipmentHistories = [] shipmentMethodHistories.each { shipmentMethodHistory -> - orderShipmentHistory = [:]; + orderShipmentHistory = [:] if ("shipmentMethodTypeId".equals(shipmentMethodHistory.changedFieldName)) { - shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", shipmentMethodHistory.newValueText).queryOne(); + shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", shipmentMethodHistory.newValueText).queryOne() if (shipmentMethodType != null){ carrierPartyHistories.each { carrierPartyHistory -> if (carrierPartyHistory.lastUpdatedTxStamp == shipmentMethodHistory.lastUpdatedTxStamp) { if ("_NA_".equals(carrierPartyHistory.newValueText)) { - orderShipmentHistory.shipmentMethod = shipmentMethodType.description; + orderShipmentHistory.shipmentMethod = shipmentMethodType.description } else { - orderShipmentHistory.shipmentMethod = carrierPartyHistory.newValueText + " " + shipmentMethodType.description; + orderShipmentHistory.shipmentMethod = carrierPartyHistory.newValueText + " " + shipmentMethodType.description } } } } - orderShipmentHistory.lastUpdated = shipmentMethodHistory.lastUpdatedTxStamp; - orderShipmentHistory.changedDate = shipmentMethodHistory.changedDate; - orderShipmentHistory.changedByUser = shipmentMethodHistory.changedByInfo; - orderShipmentHistories.add(orderShipmentHistory); + orderShipmentHistory.lastUpdated = shipmentMethodHistory.lastUpdatedTxStamp + orderShipmentHistory.changedDate = shipmentMethodHistory.changedDate + orderShipmentHistory.changedByUser = shipmentMethodHistory.changedByInfo + orderShipmentHistories.add(orderShipmentHistory) } } - context.orderShipmentHistories = orderShipmentHistories; + context.orderShipmentHistories = orderShipmentHistories changedByInfoCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "changeByUserLoginId"), - EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - changedByInfoHistories = from("EntityAuditLog").where(changedByInfoCond).orderBy("-changedDate").queryList(); + EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")] + changedByInfoHistories = from("EntityAuditLog").where(changedByInfoCond).orderBy("-changedDate").queryList() - orderUnitPriceHistories = []; + orderUnitPriceHistories = [] unitPriceCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "unitPrice"), - EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - unitPriceHistories = from("EntityAuditLog").where(unitPriceCond).orderBy("-changedDate").queryList(); + EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")] + unitPriceHistories = from("EntityAuditLog").where(unitPriceCond).orderBy("-changedDate").queryList() unitPriceHistories.each { unitPriceHistory -> - orderUnitPriceHistory = [:]; + orderUnitPriceHistory = [:] if ((unitPriceHistory.oldValueText) && (unitPriceHistory.newValueText)) { if ((Float.valueOf(unitPriceHistory.oldValueText)).compareTo(Float.valueOf(unitPriceHistory.newValueText)) != 0) { - orderUnitPriceHistory.oldValue = unitPriceHistory.oldValueText; - orderUnitPriceHistory.newValue = unitPriceHistory.newValueText; - orderUnitPriceHistory.changedDate = unitPriceHistory.changedDate; - orderItemSeqId = (unitPriceHistory.pkCombinedValueText).substring((unitPriceHistory.pkCombinedValueText).indexOf("::") + 2, (unitPriceHistory.pkCombinedValueText).length()); - orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); - orderUnitPriceHistory.productId = orderItem.productId; + orderUnitPriceHistory.oldValue = unitPriceHistory.oldValueText + orderUnitPriceHistory.newValue = unitPriceHistory.newValueText + orderUnitPriceHistory.changedDate = unitPriceHistory.changedDate + orderItemSeqId = (unitPriceHistory.pkCombinedValueText).substring((unitPriceHistory.pkCombinedValueText).indexOf("::") + 2, (unitPriceHistory.pkCombinedValueText).length()) + orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne() + orderUnitPriceHistory.productId = orderItem.productId changedByInfoHistories.each { changedByInfoHistory -> if (changedByInfoHistory.lastUpdatedTxStamp == unitPriceHistory.lastUpdatedTxStamp) { if (changedByInfoHistory.newValueText) { - orderUnitPriceHistory.changedByUser = changedByInfoHistory.newValueText; + orderUnitPriceHistory.changedByUser = changedByInfoHistory.newValueText } else { - orderUnitPriceHistory.changedByUser = changedByInfoHistory.oldValueText; + orderUnitPriceHistory.changedByUser = changedByInfoHistory.oldValueText } } } - orderUnitPriceHistories.add(orderUnitPriceHistory); + orderUnitPriceHistories.add(orderUnitPriceHistory) } } } - context.orderUnitPriceHistories = orderUnitPriceHistories; - orderQuantityHistories = []; + context.orderUnitPriceHistories = orderUnitPriceHistories + orderQuantityHistories = [] quantityCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "quantity"), - EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - quantityHistories = from("EntityAuditLog").where(quantityCond).orderBy("-changedDate").queryList(); + EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")] + quantityHistories = from("EntityAuditLog").where(quantityCond).orderBy("-changedDate").queryList() quantityHistories.each { quantityHistory -> - orderQuantityHistory = [:]; + orderQuantityHistory = [:] if ((quantityHistory.oldValueText) && (quantityHistory.newValueText)) { if ((Float.valueOf(quantityHistory.oldValueText)).compareTo(Float.valueOf(quantityHistory.newValueText)) != 0) { - orderQuantityHistory.oldValue = new BigDecimal(quantityHistory.oldValueText); - orderQuantityHistory.newValue = quantityHistory.newValueText; - orderQuantityHistory.changedDate = quantityHistory.changedDate; - orderItemSeqId = (quantityHistory.pkCombinedValueText).substring((quantityHistory.pkCombinedValueText).indexOf("::") + 2, (quantityHistory.pkCombinedValueText).length()); - orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); - orderQuantityHistory.productId = orderItem.productId; + orderQuantityHistory.oldValue = new BigDecimal(quantityHistory.oldValueText) + orderQuantityHistory.newValue = quantityHistory.newValueText + orderQuantityHistory.changedDate = quantityHistory.changedDate + orderItemSeqId = (quantityHistory.pkCombinedValueText).substring((quantityHistory.pkCombinedValueText).indexOf("::") + 2, (quantityHistory.pkCombinedValueText).length()) + orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne() + orderQuantityHistory.productId = orderItem.productId changedByInfoHistories.each { changedByInfoHistory -> if (changedByInfoHistory.lastUpdatedTxStamp == quantityHistory.lastUpdatedTxStamp) { if(changedByInfoHistory.newValueText) { - orderQuantityHistory.changedByUser = changedByInfoHistory.newValueText; + orderQuantityHistory.changedByUser = changedByInfoHistory.newValueText } else { - orderQuantityHistory.changedByUser = changedByInfoHistory.oldValueText; + orderQuantityHistory.changedByUser = changedByInfoHistory.oldValueText } } } - orderQuantityHistories.add(orderQuantityHistory); + orderQuantityHistories.add(orderQuantityHistory) } } } - context.orderQuantityHistories = orderQuantityHistories; + context.orderQuantityHistories = orderQuantityHistories } Modified: ofbiz/trunk/applications/order/groovyScripts/order/OrderList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/OrderList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/OrderList.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/OrderList.groovy Wed Nov 2 19:09:13 2016 @@ -17,42 +17,42 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.order.order.OrderListState; - -partyId = request.getParameter("partyId"); -facilityId = request.getParameter("facilityId"); - -state = OrderListState.getInstance(request); -state.update(request); -context.state = state; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.order.order.OrderListState + +partyId = request.getParameter("partyId") +facilityId = request.getParameter("facilityId") + +state = OrderListState.getInstance(request) +state.update(request) +context.state = state // check permission for each order type -hasPermission = false; +hasPermission = false if (security.hasEntityPermission("ORDERMGR", "_VIEW", session)) { if (state.hasType("view_SALES_ORDER") || (!(state.hasType("view_SALES_ORDER")) && !(state.hasType("view_PURCHASE_ORDER")))) { - hasPermission = true; - salesOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER"); + hasPermission = true + salesOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER") } } if (security.hasEntityPermission("ORDERMGR", "_PURCHASE_VIEW", session)) { if (state.hasType("view_PURCHASE_ORDER") || (!(state.hasType("view_SALES_ORDER")) && !(state.hasType("view_PURCHASE_ORDER")))) { - hasPermission = true; - purchaseOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER"); + hasPermission = true + purchaseOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER") } } -context.hasPermission = hasPermission; +context.hasPermission = hasPermission -orderHeaderList = state.getOrders(facilityId, filterDate, delegator); -context.orderHeaderList = orderHeaderList; +orderHeaderList = state.getOrders(facilityId, filterDate, delegator) +context.orderHeaderList = orderHeaderList // a list of order type descriptions -ordertypes = from("OrderType").cache(true).queryList(); +ordertypes = from("OrderType").cache(true).queryList() ordertypes.each { type -> - context["descr_" + type.orderTypeId] = type.get("description",locale); + context["descr_" + type.orderTypeId] = type.get("description",locale) } -context.filterDate = filterDate; +context.filterDate = filterDate Modified: ofbiz/trunk/applications/order/groovyScripts/order/OrderStats.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/OrderStats.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/order/OrderStats.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/order/OrderStats.groovy Wed Nov 2 19:09:13 2016 @@ -17,39 +17,39 @@ * under the License. */ -import java.math.BigDecimal; -import java.util.*; -import java.sql.Timestamp; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.base.util.*; +import java.math.BigDecimal +import java.util.* +import java.sql.Timestamp +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.base.util.* BigDecimal calcItemTotal(List headers) { - BigDecimal total = BigDecimal.ZERO; + BigDecimal total = BigDecimal.ZERO headers.each { header -> - total = total.plus(header.grandTotal ?: BigDecimal.ZERO); + total = total.plus(header.grandTotal ?: BigDecimal.ZERO) } - return total; + return total } double calcItemCount(List items) { - double count = 0.00; + double count = 0.00 items.each { item -> - count += item.quantity ?: 0.00; + count += item.quantity ?: 0.00 } - return count; + return count } -dayBegin = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale); -weekBegin = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale); -monthBegin = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale); -yearBegin = UtilDateTime.getYearStart(nowTimestamp, timeZone, locale); - -dayEnd = UtilDateTime.getDayEnd(nowTimestamp, timeZone, locale); -weekEnd = UtilDateTime.getWeekEnd(nowTimestamp, timeZone, locale); -monthEnd = UtilDateTime.getMonthEnd(nowTimestamp, timeZone, locale); -yearEnd = UtilDateTime.getYearEnd(nowTimestamp, timeZone, locale); +dayBegin = UtilDateTime.getDayStart(nowTimestamp, timeZone, locale) +weekBegin = UtilDateTime.getWeekStart(nowTimestamp, timeZone, locale) +monthBegin = UtilDateTime.getMonthStart(nowTimestamp, timeZone, locale) +yearBegin = UtilDateTime.getYearStart(nowTimestamp, timeZone, locale) + +dayEnd = UtilDateTime.getDayEnd(nowTimestamp, timeZone, locale) +weekEnd = UtilDateTime.getWeekEnd(nowTimestamp, timeZone, locale) +monthEnd = UtilDateTime.getMonthEnd(nowTimestamp, timeZone, locale) +yearEnd = UtilDateTime.getYearEnd(nowTimestamp, timeZone, locale) // order status report ecl = EntityCondition.makeCondition([ @@ -57,52 +57,52 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd)], - EntityOperator.AND); -dayList = from("OrderStatus").where(ecl).queryList(); -context.dayOrder = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CREATED"]); -context.dayApprove = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_APPROVED"]); -context.dayComplete = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_COMPLETED"]); -context.dayCancelled = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CANCELLED"]); -context.dayRejected = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_REJECTED"]); + EntityOperator.AND) +dayList = from("OrderStatus").where(ecl).queryList() +context.dayOrder = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CREATED"]) +context.dayApprove = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_APPROVED"]) +context.dayComplete = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_COMPLETED"]) +context.dayCancelled = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CANCELLED"]) +context.dayRejected = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_REJECTED"]) ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd)], - EntityOperator.AND); -weekList = from("OrderStatus").where(ecl).queryList(); -context.weekOrder = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CREATED"]); -context.weekApprove = EntityUtil.filterByAnd(weekList, [statusId: "ORDER_APPROVED"]); -context.weekComplete = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_COMPLETED"]); -context.weekCancelled = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CANCELLED"]); -context.weekRejected = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_REJECTED"]); + EntityOperator.AND) +weekList = from("OrderStatus").where(ecl).queryList() +context.weekOrder = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CREATED"]) +context.weekApprove = EntityUtil.filterByAnd(weekList, [statusId: "ORDER_APPROVED"]) +context.weekComplete = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_COMPLETED"]) +context.weekCancelled = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CANCELLED"]) +context.weekRejected = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_REJECTED"]) ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd)], - EntityOperator.AND); -monthList = from("OrderStatus").where(ecl).queryList(); -context.monthOrder = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CREATED"]); -context.monthApprove = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_APPROVED"]); -context.monthComplete = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_COMPLETED"]); -context.monthCancelled = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CANCELLED"]); -context.monthRejected = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_REJECTED"]); + EntityOperator.AND) +monthList = from("OrderStatus").where(ecl).queryList() +context.monthOrder = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CREATED"]) +context.monthApprove = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_APPROVED"]) +context.monthComplete = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_COMPLETED"]) +context.monthCancelled = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CANCELLED"]) +context.monthRejected = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_REJECTED"]) ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd)], - EntityOperator.AND); -yearList = from("OrderStatus").where(ecl).queryList(); -context.yearOrder = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CREATED"]); -context.yearApprove = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_APPROVED"]); -context.yearComplete = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_COMPLETED"]); -context.yearCancelled = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CANCELLED"]); -context.yearRejected = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_REJECTED"]); + EntityOperator.AND) +yearList = from("OrderStatus").where(ecl).queryList() +context.yearOrder = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CREATED"]) +context.yearApprove = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_APPROVED"]) +context.yearComplete = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_COMPLETED"]) +context.yearCancelled = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CANCELLED"]) +context.yearRejected = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_REJECTED"]) // order totals and item counts ecl = EntityCondition.makeCondition([ @@ -111,9 +111,9 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); -dayItems = from("OrderHeaderAndItems").where(ecl).queryList(); -dayItemsPending = EntityUtil.filterByAnd(dayItems, [itemStatusId : "ITEM_ORDERED"]); + EntityOperator.AND) +dayItems = from("OrderHeaderAndItems").where(ecl).queryList() +dayItemsPending = EntityUtil.filterByAnd(dayItems, [itemStatusId : "ITEM_ORDERED"]) ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), @@ -121,22 +121,22 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); -dayHeaders = from("OrderHeader").where(ecl).queryList(); -dayHeadersPending = EntityUtil.filterByAnd(dayHeaders, [statusId : "ORDER_CREATED"]); - -dayItemTotal = calcItemTotal(dayHeaders); -dayItemCount = calcItemCount(dayItems); -dayItemTotalPending = calcItemTotal(dayHeadersPending); -dayItemCountPending = calcItemCount(dayItemsPending); -dayItemTotalPaid = dayItemTotal - dayItemTotalPending; -dayItemCountPaid = dayItemCount - dayItemCountPending; -context.dayItemTotal = dayItemTotal; -context.dayItemCount = dayItemCount; -context.dayItemTotalPending = dayItemTotalPending; -context.dayItemCountPending = dayItemCountPending; -context.dayItemTotalPaid = dayItemTotalPaid; -context.dayItemCountPaid = dayItemCountPaid; + EntityOperator.AND) +dayHeaders = from("OrderHeader").where(ecl).queryList() +dayHeadersPending = EntityUtil.filterByAnd(dayHeaders, [statusId : "ORDER_CREATED"]) + +dayItemTotal = calcItemTotal(dayHeaders) +dayItemCount = calcItemCount(dayItems) +dayItemTotalPending = calcItemTotal(dayHeadersPending) +dayItemCountPending = calcItemCount(dayItemsPending) +dayItemTotalPaid = dayItemTotal - dayItemTotalPending +dayItemCountPaid = dayItemCount - dayItemCountPending +context.dayItemTotal = dayItemTotal +context.dayItemCount = dayItemCount +context.dayItemTotalPending = dayItemTotalPending +context.dayItemCountPending = dayItemCountPending +context.dayItemTotalPaid = dayItemTotalPaid +context.dayItemCountPaid = dayItemCountPaid ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), @@ -144,9 +144,9 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); -weekItems = from("OrderHeaderAndItems").where(ecl).queryList(); -weekItemsPending = EntityUtil.filterByAnd(weekItems, [itemStatusId : "ITEM_ORDERED"]); + EntityOperator.AND) +weekItems = from("OrderHeaderAndItems").where(ecl).queryList() +weekItemsPending = EntityUtil.filterByAnd(weekItems, [itemStatusId : "ITEM_ORDERED"]) ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), @@ -154,22 +154,22 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); -weekHeaders = from("OrderHeader").where(ecl).queryList(); -weekHeadersPending = EntityUtil.filterByAnd(weekHeaders, [statusId : "ORDER_CREATED"]); - -weekItemTotal = calcItemTotal(weekHeaders); -weekItemCount = calcItemCount(weekItems); -weekItemTotalPending = calcItemTotal(weekHeadersPending); -weekItemCountPending = calcItemCount(weekItemsPending); -weekItemTotalPaid = weekItemTotal - weekItemTotalPending; -weekItemCountPaid = weekItemCount - weekItemCountPending; -context.weekItemTotal = weekItemTotal; -context.weekItemCount = weekItemCount; -context.weekItemTotalPending = weekItemTotalPending; -context.weekItemCountPending = weekItemCountPending; -context.weekItemTotalPaid = weekItemTotalPaid; -context.weekItemCountPaid = weekItemCountPaid; + EntityOperator.AND) +weekHeaders = from("OrderHeader").where(ecl).queryList() +weekHeadersPending = EntityUtil.filterByAnd(weekHeaders, [statusId : "ORDER_CREATED"]) + +weekItemTotal = calcItemTotal(weekHeaders) +weekItemCount = calcItemCount(weekItems) +weekItemTotalPending = calcItemTotal(weekHeadersPending) +weekItemCountPending = calcItemCount(weekItemsPending) +weekItemTotalPaid = weekItemTotal - weekItemTotalPending +weekItemCountPaid = weekItemCount - weekItemCountPending +context.weekItemTotal = weekItemTotal +context.weekItemCount = weekItemCount +context.weekItemTotalPending = weekItemTotalPending +context.weekItemCountPending = weekItemCountPending +context.weekItemTotalPaid = weekItemTotalPaid +context.weekItemCountPaid = weekItemCountPaid ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), @@ -177,9 +177,9 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); + EntityOperator.AND) monthItems = from("OrderHeaderAndItems").where(ecl).queryList() -monthItemsPending = EntityUtil.filterByAnd(monthItems, [itemStatusId : "ITEM_ORDERED"]); +monthItemsPending = EntityUtil.filterByAnd(monthItems, [itemStatusId : "ITEM_ORDERED"]) ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), @@ -187,22 +187,22 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); -monthHeaders = from("OrderHeader").where(ecl).queryList(); -monthHeadersPending = EntityUtil.filterByAnd(monthHeaders, [statusId : "ORDER_CREATED"]); - -monthItemTotal = calcItemTotal(monthHeaders); -monthItemCount = calcItemCount(monthItems); -monthItemTotalPending = calcItemTotal(monthHeadersPending); -monthItemCountPending = calcItemCount(monthItemsPending); -monthItemTotalPaid = monthItemTotal - monthItemTotalPending; -monthItemCountPaid = monthItemCount - monthItemCountPending; -context.monthItemTotal = monthItemTotal; -context.monthItemCount = monthItemCount; -context.monthItemTotalPending = monthItemTotalPending; -context.monthItemCountPending = monthItemCountPending; -context.monthItemTotalPaid = monthItemTotalPaid; -context.monthItemCountPaid = monthItemCountPaid; + EntityOperator.AND) +monthHeaders = from("OrderHeader").where(ecl).queryList() +monthHeadersPending = EntityUtil.filterByAnd(monthHeaders, [statusId : "ORDER_CREATED"]) + +monthItemTotal = calcItemTotal(monthHeaders) +monthItemCount = calcItemCount(monthItems) +monthItemTotalPending = calcItemTotal(monthHeadersPending) +monthItemCountPending = calcItemCount(monthItemsPending) +monthItemTotalPaid = monthItemTotal - monthItemTotalPending +monthItemCountPaid = monthItemCount - monthItemCountPending +context.monthItemTotal = monthItemTotal +context.monthItemCount = monthItemCount +context.monthItemTotalPending = monthItemTotalPending +context.monthItemCountPending = monthItemCountPending +context.monthItemTotalPaid = monthItemTotalPaid +context.monthItemCountPaid = monthItemCountPaid ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), @@ -210,9 +210,9 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); -yearItems = from("OrderHeaderAndItems").where(ecl).queryList(); -yearItemsPending = EntityUtil.filterByAnd(yearItems, [itemStatusId : "ITEM_ORDERED"]); + EntityOperator.AND) +yearItems = from("OrderHeaderAndItems").where(ecl).queryList() +yearItemsPending = EntityUtil.filterByAnd(yearItems, [itemStatusId : "ITEM_ORDERED"]) ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), @@ -220,29 +220,29 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin), EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], - EntityOperator.AND); -yearHeaders = from("OrderHeader").where(ecl).queryList(); -yearHeadersPending = EntityUtil.filterByAnd(yearHeaders, [statusId : "ORDER_CREATED"]); - -yearItemTotal = calcItemTotal(yearHeaders); -yearItemCount = calcItemCount(yearItems); -yearItemTotalPending = calcItemTotal(yearHeadersPending); -yearItemCountPending = calcItemCount(yearItemsPending); -yearItemTotalPaid = yearItemTotal - yearItemTotalPending; -yearItemCountPaid = yearItemCount - yearItemCountPending; -context.yearItemTotal = yearItemTotal; -context.yearItemCount = yearItemCount; -context.yearItemTotalPending = yearItemTotalPending; -context.yearItemCountPending = yearItemCountPending; -context.yearItemTotalPaid = yearItemTotalPaid; -context.yearItemCountPaid = yearItemCountPaid; + EntityOperator.AND) +yearHeaders = from("OrderHeader").where(ecl).queryList() +yearHeadersPending = EntityUtil.filterByAnd(yearHeaders, [statusId : "ORDER_CREATED"]) + +yearItemTotal = calcItemTotal(yearHeaders) +yearItemCount = calcItemCount(yearItems) +yearItemTotalPending = calcItemTotal(yearHeadersPending) +yearItemCountPending = calcItemCount(yearItemsPending) +yearItemTotalPaid = yearItemTotal - yearItemTotalPending +yearItemCountPaid = yearItemCount - yearItemCountPending +context.yearItemTotal = yearItemTotal +context.yearItemCount = yearItemCount +context.yearItemTotalPending = yearItemTotalPending +context.yearItemCountPending = yearItemCountPending +context.yearItemTotalPaid = yearItemTotalPaid +context.yearItemCountPaid = yearItemCountPaid // order state report -waitingPayment = from("OrderHeader").where("statusId", "ORDER_CREATED", "orderTypeId", "SALES_ORDER").queryList(); -context.waitingPayment = waitingPayment.size(); +waitingPayment = from("OrderHeader").where("statusId", "ORDER_CREATED", "orderTypeId", "SALES_ORDER").queryList() +context.waitingPayment = waitingPayment.size() -waitingApproval = from("OrderHeader").where("statusId", "ORDER_PROCESSING", "orderTypeId", "SALES_ORDER").queryList(); -context.waitingApproval = waitingApproval.size(); +waitingApproval = from("OrderHeader").where("statusId", "ORDER_PROCESSING", "orderTypeId", "SALES_ORDER").queryList() +context.waitingApproval = waitingApproval.size() -waitingComplete = from("OrderHeader").where("statusId", "ORDER_APPROVED", "orderTypeId", "SALES_ORDER").queryList(); -context.waitingComplete = waitingComplete.size(); +waitingComplete = from("OrderHeader").where("statusId", "ORDER_APPROVED", "orderTypeId", "SALES_ORDER").queryList() +context.waitingComplete = waitingComplete.size() |
Free forum by Nabble | Edit this page |