svn commit: r433301 - in /incubator/ofbiz/trunk/applications/order: config/ src/org/ofbiz/order/order/ src/org/ofbiz/order/shoppingcart/ webapp/ordermgr/WEB-INF/actions/order/ webapp/ordermgr/entry/ webapp/ordermgr/order/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r433301 - in /incubator/ofbiz/trunk/applications/order: config/ src/org/ofbiz/order/order/ src/org/ofbiz/order/shoppingcart/ webapp/ordermgr/WEB-INF/actions/order/ webapp/ordermgr/entry/ webapp/ordermgr/order/

sichen
Author: sichen
Date: Mon Aug 21 10:37:33 2006
New Revision: 433301

URL: http://svn.apache.org/viewvc?rev=433301&view=rev
Log:
Set an OrderPaymentPreference for EXT_BILLACT with maxAmount being the amount user chose or amount available on account still when billing account is used during checkout.  OFBIZ-120

Modified:
    incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl

Modified: incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?rev=433301&r1=433300&r2=433301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties Mon Aug 21 10:37:33 2006
@@ -288,6 +288,7 @@
 OrderPartySelectRoleForParty=Select Role For Party
 OrderPaymentOfflineCheckMoney = Offline Payment: Check/Money Order
 OrderPaymentType=Payment Type
+OrderPaymentMaximumAmount =Max Amount
 OrderPendingPaymentDollarAmountsIncludesAdjustments=Pending Payment Dollar Amounts (includes adjustments)
 OrderPendingPaymentItemsSoldIncludesPromotions=Pending Payment Items Sold (includes promotions)
 OrderPickOrders=Pick Orders

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=433301&r1=433300&r2=433301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Mon Aug 21 10:37:33 2006
@@ -558,6 +558,24 @@
         return billingAccount;
     }
 
+    /**
+     * Returns the OrderPaymentPreference.maxAmount for the billing account associated with the order, or 0 if there is no
+     * billing account or no max amount set
+     */
+    public double getBillingAccountMaxAmount() {
+        if (getBillingAccount() == null) {
+            return 0.0;
+        } else {
+            List paymentPreferences = getPaymentPreferences();
+            GenericValue billingAccountPaymentPreference = EntityUtil.getFirst(EntityUtil.filterByAnd(paymentPreferences, UtilMisc.toMap("paymentMethodTypeId", "EXT_BILLACT")));
+            if ((billingAccountPaymentPreference != null) && (billingAccountPaymentPreference.getDouble("maxAmount") != null)) {
+                return billingAccountPaymentPreference.getDouble("maxAmount").doubleValue();
+            } else {
+                return 0.0;
+            }
+        }
+    }
+
     public GenericValue getBillToParty() {
         return this.getPartyFromRole("BILL_TO_CUSTOMER");
     }

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=433301&r1=433300&r2=433301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Mon Aug 21 10:37:33 2006
@@ -200,19 +200,12 @@
             }
 
             String billingAccountId = request.getParameter("billingAccountId");
-            String billingAcctAmtStr = request.getParameter("amount_" + billingAccountId);
-            Double billingAccountAmt = null;
-            // parse the amount to a decimal
-            if (billingAcctAmtStr != null) {
-                try {
-                    billingAccountAmt = new Double(formatter.parse(billingAcctAmtStr).doubleValue());
-                } catch (ParseException e) {
-                    Debug.logError(e, module);
-                    Map messageMap = UtilMisc.toMap("billingAccountId", billingAccountId);
-                    String errMsg = UtilProperties.getMessage(resource, "checkevents.invalid_amount_set_for_billing_account", messageMap, (cart != null ? cart.getLocale() : Locale.getDefault()));
-                    request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                    return "error";
-                }
+            Double billingAccountAmt = determineBillingAccountAmount(request, checkOutHelper, formatter);
+            if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) {
+                Map messageMap = UtilMisc.toMap("billingAccountId", billingAccountId);
+                String errMsg = UtilProperties.getMessage(resource, "checkevents.invalid_amount_set_for_billing_account", messageMap, (cart != null ? cart.getLocale() : Locale.getDefault()));
+                request.setAttribute("_ERROR_MESSAGE_", errMsg);
+                return "error";
             }
 
             List singleUsePayments = new ArrayList();
@@ -360,6 +353,10 @@
         String shipAfterDate = request.getParameter("shipAfterDate");
         List singleUsePayments = new ArrayList();
 
+        // get a request map of parameters
+        Map params = UtilHttp.getParameterMap(request);
+        CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
+
         // if taxAuthPartyGeoIds is not empty drop that into the database
         if (UtilValidate.isNotEmpty(taxAuthPartyGeoIds)) {
             try {
@@ -378,25 +375,14 @@
         
         // get the billing account and amount
         String billingAccountId = request.getParameter("billingAccountId");
-        String billingAcctAmtStr = request.getParameter("amount_" + billingAccountId);
-        Double billingAccountAmt = null;
-        // parse the amount to a decimal
-        if (billingAcctAmtStr != null) {
-            try {
-                billingAccountAmt = new Double(formatter.parse(billingAcctAmtStr).doubleValue());
-            } catch (ParseException e) {
-                Debug.logError(e, module);
-                Map messageMap = UtilMisc.toMap("billingAccountId", billingAccountId);
-                String errMsg = UtilProperties.getMessage(resource, "checkevents.invalid_amount_set_for_billing_account", messageMap, (cart != null ? cart.getLocale() : Locale.getDefault()));
-                request.setAttribute("_ERROR_MESSAGE_", errMsg);
-                return "error";
-            }
+        Double billingAccountAmt = determineBillingAccountAmount(request, checkOutHelper, formatter);
+        if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) {
+            Map messageMap = UtilMisc.toMap("billingAccountId", billingAccountId);
+            String errMsg = UtilProperties.getMessage(resource, "checkevents.invalid_amount_set_for_billing_account", messageMap, (cart != null ? cart.getLocale() : Locale.getDefault()));
+            request.setAttribute("_ERROR_MESSAGE_", errMsg);
+            return "error";
         }
 
-        // get a request map of parameters
-        Map params = UtilHttp.getParameterMap(request);
-        CheckOutHelper checkOutHelper = new CheckOutHelper(dispatcher, delegator, cart);
-
         // check for gift card not on file
         Map gcResult = checkOutHelper.checkGiftCard(params, selectedPaymentMethods);
         ServiceUtil.getMessages(request, gcResult, null);
@@ -794,27 +780,14 @@
             }
 
             String billingAccountId = request.getParameter("billingAccountId");
-            String billingAcctAmtStr = request.getParameter("amount_" + billingAccountId);
-            Double billingAccountAmt = null;
-
-            // parse the amount to a decimal
-            if (billingAcctAmtStr != null) {
-                Locale locale = UtilHttp.getLocale(request);
-                // get the currency format
-                String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
-                DecimalFormat formatter = new DecimalFormat(currencyFormat);
-                try {
-                    billingAccountAmt = new Double(formatter.parse(billingAcctAmtStr).doubleValue());
-                } catch (ParseException e) {
-                    Debug.logError(e, module);
-                    request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId",billingAccountId), locale));
-                    return "error";
-                }
+            String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
+            DecimalFormat formatter = new DecimalFormat(currencyFormat);
+            Double billingAccountAmt = determineBillingAccountAmount(request, checkOutHelper, formatter);
+            if ((billingAccountId != null) && !"_NA_".equals(billingAccountId) && (billingAccountAmt == null)) {
+                request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidAmountSetForBillingAccount", UtilMisc.toMap("billingAccountId",billingAccountId), (cart != null ? cart.getLocale() : Locale.getDefault())));
+                return "error";
             }
-
-            // ??? FIXME
-            checkOutHelper.setCheckOutPayment(selectedPaymentMethods, null, billingAccountId, billingAccountAmt);
-            // -----------
+              
             Map selPaymentMethods = null;
             if (checkOutPaymentId != null) {
                 callResult = checkOutHelper.finalizeOrderEntryPayment(checkOutPaymentId, null, isSingleUsePayment, doAppendPayment);
@@ -947,5 +920,50 @@
         } else {
             return finalizePage;
         }
+    }
+
+    /**
+     * Determine what billing account amount to use based on the form input.
+     * This method returns the amount that will be charged to the billing account.
+     *
+     * An amount can be associated with the billingAccountId with a
+     * parameter amount_${billingAccountId}.  If no amount is specified, then
+     * the entire available ballance of the given billing account will be used.
+     * If there is an error, a null will be returned.
+     *
+     * @return  Amount to charge billing account or null if there was an error
+     */
+    private static Double determineBillingAccountAmount(HttpServletRequest request, CheckOutHelper checkOutHelper, DecimalFormat formatter) {
+        ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart");
+        String billingAccountId = request.getParameter("billingAccountId");
+        String billingAcctAmtStr = request.getParameter("amount_" + billingAccountId);
+        Double billingAccountAmt = null;
+
+        // parse the amount to a decimal
+        if (billingAcctAmtStr != null) {
+            try {
+                billingAccountAmt = new Double(formatter.parse(billingAcctAmtStr).doubleValue());
+            } catch (ParseException e) {
+                return null;
+            }
+        }
+
+        // set the billing account amount to the minimum of billing account available balance or amount input if less than balance
+        if ((cart != null) && (billingAccountId != null) && !"_NA_".equals(billingAccountId)) {
+            double availableBalance = checkOutHelper.availableAccountBalance(billingAccountId);
+
+            // set amount to be charged to entered amount unless it exceeds the available balance
+            double chargeAmount = 0;
+            if ((billingAccountAmt != null) && (billingAccountAmt.doubleValue() < availableBalance)) {
+                chargeAmount = billingAccountAmt.doubleValue();
+            } else {
+                chargeAmount = availableBalance;
+            }
+
+            return new Double(chargeAmount);
+        } else {
+            return null;
+        }
+
     }
 }

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=433301&r1=433300&r2=433301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Mon Aug 21 10:37:33 2006
@@ -246,19 +246,12 @@
             singleUsePayments = new ArrayList();
         }
 
-        // set the billing account amount
-        if (billingAccountId != null && billingAccountAmt != null && !billingAccountId.equals("_NA_")) {
-            cart.setBillingAccount(billingAccountId, billingAccountAmt.doubleValue());
-        } else {
-            cart.setBillingAccount(null, 0.00);
-        }
-
         // set the payment method option
         if (selectedPaymentMethods != null && selectedPaymentMethods.size() > 0) {
             // clear out the old payments
             cart.clearPayments();
 
-            // if we are EXT_BILLACT (billing account only) then we need to make sure we have enough credit
+            // if checkoutPaymentId == EXT_BILLACT, then we have billing account only, so make sure we have enough credit
             if (selectedPaymentMethods.containsKey("EXT_BILLACT")) {
                 double accountCredit = this.availableAccountBalance(cart.getBillingAccountId());
                 // make sure we have enough to cover; if this is selected we don't have other payment methods
@@ -269,6 +262,16 @@
                 }
             }
 
+            if (billingAccountId != null && billingAccountAmt != null && !billingAccountId.equals("_NA_")) {
+                // set cart billing account data and generate a payment method containing the amount we will be charging
+                cart.setBillingAccount(billingAccountId, billingAccountAmt.doubleValue());
+                selectedPaymentMethods.put("EXT_BILLACT", new Double(cart.getBillingAccountAmount()));
+            } else if ("_NA_".equals(billingAccountId)) {
+                // if _NA_ was supplied, erase all billing account data
+                cart.setBillingAccount(null, 0.0);
+                cart.clearPayment("EXT_BILLACT");
+            }
+
             Set paymentMethods = selectedPaymentMethods.keySet();
             Iterator i = paymentMethods.iterator();
             while (i.hasNext()) {
@@ -1352,19 +1355,17 @@
     }
 
     public double availableAccountBalance(String billingAccountId) {
-        GenericValue billingAccount = null;
-        Double availableBalance = new Double(0.00);
-
-        if (billingAccountId != null) {
-            try {
-                Map res = dispatcher.runSync("calcBillingAccountBalance", UtilMisc.toMap("billingAccountId", billingAccountId));
-                availableBalance = (Double) res.get("availableBalance");
-            } catch (GenericServiceException e) {
-                Debug.logError(e, module);
+        if (billingAccountId == null) return 0.0;
+        try {
+            Map res = dispatcher.runSync("calcBillingAccountBalance", UtilMisc.toMap("billingAccountId", billingAccountId));
+            Double availableBalance = (Double) res.get("availableBalance");
+            if (availableBalance != null) {
+                return availableBalance.doubleValue();
             }
+        } catch (GenericServiceException e) {
+            Debug.logError(e, module);
         }
-
-        return availableBalance.doubleValue();
+        return 0.0;
     }
 
     public Map makeBillingAccountMap(List paymentPrefs) {
@@ -1424,7 +1425,7 @@
             while (npi.hasNext()) {
                 String paymentMethodId = (String) npi.next();
                 double selectedPaymentTotal = cart.getPaymentTotal();
-                double requiredAmount = cart.getGrandTotal() - cart.getBillingAccountAmount();
+                double requiredAmount = cart.getGrandTotal();
                 double nullAmount = requiredAmount - selectedPaymentTotal;
                 boolean setOverflow = false;
 

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh?rev=433301&r1=433300&r2=433301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh Mon Aug 21 10:37:33 2006
@@ -117,6 +117,7 @@
 
     billingAccount = orderHeader.getRelatedOne("BillingAccount");
     context.put("billingAccount", billingAccount);
+    context.put("billingAccountMaxAmount", orderReadHelper.getBillingAccountMaxAmount());
 
     // get a list of all shipments, and a list of ItemIssuances per order item
     allShipmentsMap = new HashMap();

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=433301&r1=433300&r2=433301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl Mon Aug 21 10:37:33 2006
@@ -78,19 +78,19 @@
                   <#assign availableAmount = billingAccount.accountLimit?double - billingAccount.accountBalance?double>
                   <tr>
                     <td align="left" valign="top" width="1%">
-                      <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="${billingAccount.billingAccountId}" <#if (billingAccount.billingAccountId == selectedBillingAccount?default(""))>checked="checked"</#if>/>
+                      <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="${billingAccount.billingAccountId}" <#if (billingAccount.billingAccountId == selectedBillingAccountId?default(""))>checked="checked"</#if>/>
                     </td>
                     <td align="left" valign="top" width="99%">
                       <div class="tabletext">
                        ${billingAccount.description?default("Bill Account")} #<b>${billingAccount.billingAccountId}</b>&nbsp;(<@ofbizCurrency amount=availableAmount isoCode=billingAccount.accountCurrencyUomId/>)<br/>
-                       <b>${uiLabelMap.AccountingBillUpTo}:</b> <input type="text" size="5" class="inputBox" name="amount_${billingAccount.billingAccountId}" value="${availableAmount?double?string("##0.00")}" <#if !(billingAccount.billingAccountId == selectedBillingAccount?default(""))>disabled="disabled"</#if>/>
+                       <b>${uiLabelMap.AccountingBillUpTo}:</b> <input type="text" size="5" class="inputBox" name="amount_${billingAccount.billingAccountId}" value="${availableAmount?double?string("##0.00")}" <#if !(billingAccount.billingAccountId == selectedBillingAccountId?default(""))>disabled="disabled"</#if>/>
                       </div>
                     </td>
                   </tr>
                 </#list>
                 <tr>
                   <td align="left" valign="top" width="1%">
-                    <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="_NA" <#if (selectedBillingAccount?default("") == "N")>checked="checked"</#if>/>
+                    <input type="radio" onClick="javascript:toggleBillingAccount(this);" name="billingAccountId" value="_NA_" <#if (selectedBillingAccountId?default("") == "N")>checked="checked"</#if>/>
                     <input type="hidden" name="_NA_amount" value="0.00"/>
                   </td>
                   <td align="left" valign="top" width="99%">

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl?rev=433301&r1=433300&r2=433301&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl Mon Aug 21 10:37:33 2006
@@ -275,14 +275,20 @@
                     <#else>
                       <tr>
                         <td align="right" valign="top" width="15%">
-                          <div class="tabletext">&nbsp;<b>${paymentMethodType.get("description",locale)?if_exists}</b></div>
+                          <div class="tabletext">&nbsp;<b>${paymentMethodType.get("description",locale)?if_exists}</b>
+                          <#if orderPaymentPreference.maxAmount?has_content>
+                          <br/>${uiLabelMap.OrderPaymentMaximumAmount}: <@ofbizCurrency amount=orderPaymentPreference.maxAmount?default(0.00) isoCode=currencyUomId/>
+                          </#if>
+                          </div>
                         </td>
                         <td width="5">&nbsp;</td>
                         <#if paymentMethodType.paymentMethodTypeId != "EXT_OFFLINE">
                           <td align="left">
                             <div class="tabletext">
-                              <@ofbizCurrency amount=orderPaymentPreference.maxAmount?default(0.00) isoCode=currencyUomId/>
-                              &nbsp;[<#if oppStatusItem?exists>${oppStatusItem.get("description",locale)}<#else>${orderPaymentPreference.statusId}</#if>]
+                              <#if orderPaymentPreference.maxAmount?has_content>
+                                 <br/>${uiLabelMap.OrderPaymentMaximumAmount}: <@ofbizCurrency amount=orderPaymentPreference.maxAmount?default(0.00) isoCode=currencyUomId/>
+                              </#if>
+                              <br/>&nbsp;[<#if oppStatusItem?exists>${oppStatusItem.get("description",locale)}<#else>${orderPaymentPreference.statusId}</#if>]
                             </div>
                             <#--
                             <div class="tabletext"><@ofbizCurrency amount=orderPaymentPreference.maxAmount?default(0.00) isoCode=currencyUomId/>&nbsp;-&nbsp;${(orderPaymentPreference.authDate.toString())?if_exists}</div>
@@ -305,7 +311,11 @@
                       </#if>
                       <tr>
                         <td align="right" valign="top" width="15%">
-                          <div class="tabletext">&nbsp;<b>${uiLabelMap.AccountingCreditCard}</b></div>
+                          <div class="tabletext">&nbsp;<b>${uiLabelMap.AccountingCreditCard}</b>
+                          <#if orderPaymentPreference.maxAmount?has_content>
+                             <br/>${uiLabelMap.OrderPaymentMaximumAmount}: <@ofbizCurrency amount=orderPaymentPreference.maxAmount?default(0.00) isoCode=currencyUomId/>
+                          </#if>
+                          </div>
                         </td>
                         <td width="5">&nbsp;</td>
                         <td align="left" valign="top" width="80%">
@@ -369,7 +379,11 @@
                       </#if>
                       <tr>
                         <td align="right" valign="top" width="15%">
-                          <div class="tabletext">&nbsp;<b>${uiLabelMap.AccountingEFTAccount}</b></div>
+                          <div class="tabletext">&nbsp;<b>${uiLabelMap.AccountingEFTAccount}</b>
+                          <#if orderPaymentPreference.maxAmount?has_content>
+                          <br/>${uiLabelMap.OrderPaymentMaximumAmount}: <@ofbizCurrency amount=orderPaymentPreference.maxAmount?default(0.00) isoCode=currencyUomId/>
+                          </#if>
+                          </div>
                         </td>
                         <td width="5">&nbsp;</td>
                         <td align="left" valign="top" width="80%">
@@ -392,7 +406,11 @@
                       </#if>
                       <tr>
                         <td align="right" valign="top" width="15%">
-                          <div class="tabletext">&nbsp;<b>${uiLabelMap.OrderGiftCard}</b></div>
+                          <div class="tabletext">&nbsp;<b>${uiLabelMap.OrderGiftCard}</b>
+                          <#if orderPaymentPreference.maxAmount?has_content>
+                          <br/>${uiLabelMap.OrderPaymentMaximumAmount}: <@ofbizCurrency amount=orderPaymentPreference.maxAmount?default(0.00) isoCode=currencyUomId/>
+                          </#if>
+                          </div>
                         </td>
                         <td width="5">&nbsp;</td>
                         <td align="left" valign="top" width="80%">
@@ -457,7 +475,12 @@
                   </#if>
                   <tr>
                     <td align="right" valign="top" width="15%">
-                      <div class="tabletext">&nbsp;<b>${uiLabelMap.AccountingBillingAccount}</b></div>
+                      <#-- billing accounts require a special OrderPaymentPreference because it is skipped from above section of OPPs -->
+                      <div class="tabletext">&nbsp;<b>${uiLabelMap.AccountingBillingAccount}</b>
+                          <#if billingAccountMaxAmount?has_content>
+                          <br/>${uiLabelMap.OrderPaymentMaximumAmount}: <@ofbizCurrency amount=billingAccountMaxAmount?default(0.00) isoCode=currencyUomId/>
+                          </#if>
+                          </div>
                     </td>
                     <td width="5">&nbsp;</td>
                     <td align="left" valign="top" width="80%">