I need help in Invertory section in facility tab.

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

I need help in Invertory section in facility tab.

gopalbi
Hello friends,

  please help me.

When i go to Facility-->Facilities-->Inventoy Search option form. if i am putting productId like (WG-1111) then it show the exception like
-------------------------------------****************------------------------
:ERROR MESSAGE:
org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen [component://product/widget/facility/FacilityScreens.xml#ViewFacilityInventoryByProduct]: groovy.lang.MissingMethodException: No signature of method: static org.ofbiz.entity.condition.EntityCondition.makeCondition() is applicable for argument types: (java.lang.String, java.lang.Boolean, org.ofbiz.entity.condition.EntityOperator$8, java.lang.String, java.lang.Boolean) values: {"productId", true, LIKE, "WG-1111%", true} (No signature of method: static org.ofbiz.entity.condition.EntityCondition.makeCondition() is applicable for argument types: (java.lang.String, java.lang.Boolean, org.ofbiz.entity.condition.EntityOperator$8, java.lang.String, java.lang.Boolean) values: {"productId", true, LIKE, "WG-1111%", true})

-------------------------------------*******************-------------------------------------

I am sending you the groovy file which i am using. I am unable to find where is actual problem.But if i am trying with blank productId and then click to the Find button then it show the result.




---------------------------------------ViewFacilityInventoryByProduct.groovy-----------------

import java.util.*
import java.sql.Timestamp
import org.ofbiz.base.util.*
import org.ofbiz.entity.*
import org.ofbiz.entity.condition.*
import org.ofbiz.entity.transaction.*
import org.ofbiz.entity.model.DynamicViewEntity
import org.ofbiz.entity.model.ModelKeyMap
import org.ofbiz.entity.util.EntityFindOptions
import org.ofbiz.product.inventory.*

action = request.getParameter("action");

searchParameterString = "";
searchParameterString = "action=Y&facilityId=" + facilityId;

offsetQOH = -1;
offsetATP = -1;
hasOffsetQOH = false;
hasOffsetATP = false;

rows = [] as ArrayList;

if (action) {
    // ------------------------------
    prodView = new DynamicViewEntity();
    conditionMap = [facilityId : facilityId];

    if (offsetQOHQty) {
        try {
            offsetQOH = Integer.parseInt(offsetQOHQty);
            hasOffsetQOH = true;
            searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH;
        } catch(NumberFormatException nfe) {
        }
    }
    if (offsetATPQty) {
        try {
            offsetATP = Integer.parseInt(offsetATPQty);
            hasOffsetATP = true;
            searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP;
        } catch(NumberFormatException nfe) {
        }
    }

    prodView.addMemberEntity("PRFA", "ProductFacility");
    prodView.addAliasAll("PRFA", null);

    prodView.addMemberEntity("PROD", "Product");
    prodView.addViewLink("PROD", "PRFA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
    prodView.addAlias("PROD", "internalName");
    prodView.addAlias("PROD", "isVirtual");
    prodView.addAlias("PROD", "salesDiscontinuationDate");
    if (productTypeId) {
        prodView.addAlias("PROD", "productTypeId");
        conditionMap.productTypeId = productTypeId;
        searchParameterString = searchParameterString + "&productTypeId=" + productTypeId;
    }
    if (searchInProductCategoryId) {
        prodView.addMemberEntity("PRCA", "ProductCategoryMember");
        prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
        prodView.addAlias("PRCA", "productCategoryId");
        conditionMap.productCategoryId = searchInProductCategoryId;
        searchParameterString = searchParameterString + "&searchInProductCategoryId=" + searchInProductCategoryId;
    }

    if (productSupplierId) {
        prodView.addMemberEntity("SPPR", "SupplierProduct");
        prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList("productId"));
        prodView.addAlias("SPPR", "partyId");
        conditionMap.partyId = productSupplierId;
        searchParameterString = searchParameterString + "&productSupplierId=" + productSupplierId;
    }
   
    // set distinct on so we only get one row per product
    findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true);
    searchCondition = EntityCondition.makeCondition(conditionMap, EntityOperator.AND);
    notVirtualCondition = EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null),
                                                         EntityOperator.OR,
                                                         EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"));

    whereConditionsList = [searchCondition, notVirtualCondition];
    // add the discontinuation date condition
    if (productsSoldThruTimestamp) {
        discontinuationDateCondition = EntityCondition.makeCondition(
               [
                EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.EQUALS, null),
                EntityCondition.makeCondition("salesDiscontinuationDate", EntityOperator.GREATER_THAN, productsSoldThruTimestamp)
               ],
               EntityOperator.OR);
        whereConditionsList.add(discontinuationDateCondition);
        searchParameterString = searchParameterString + "&productsSoldThruTimestamp=" + productsSoldThruTimestamp;
    }

    // add search on internal name
    if (internalName) {
        whereConditionsList.add(EntityCondition.makeCondition("internalName", true, EntityOperator.LIKE, "%" + internalName + "%", true));
        searchParameterString = searchParameterString + "&internalName=" + internalName;
    }
   
    // add search on productId
    if (productId) {
        whereConditionsList.add(EntityCondition.makeCondition("productId", true, EntityOperator.LIKE, productId + "%", true));
        searchParameterString = searchParameterString + "&productId=" + productId;
    }
    whereCondition = EntityCondition.makeCondition(whereConditionsList, EntityOperator.AND);

    beganTransaction = false;
    List prods = null;
    try {
        beganTransaction = TransactionUtil.begin();
        prodsEli = delegator.findListIteratorByCondition(prodView, whereCondition, null, null, ['productId'], findOpts);
        prods = prodsEli.getCompleteList();
        prodsEli.close();
    } catch (GenericEntityException e) {
        errMsg = "Failure in operation, rolling back transaction";
        Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct");
        try {
            // only rollback the transaction if we started one...
            TransactionUtil.rollback(beganTransaction, errMsg, e);
        } catch (GenericEntityException e2) {
            Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "ViewFacilityInventoryByProduct");
        }
        // after rolling back, rethrow the exception
        throw e;
    } finally {
        // only commit the transaction if we started one... this will throw an exception if it fails
        TransactionUtil.commit(beganTransaction);
    }

    // If the user has specified a number of months over which to sum usage quantities, define the correct timestamp
    Timestamp checkTime = null;
    monthsInPastLimitStr = request.getParameter("monthsInPastLimit");
    if (monthsInPastLimitStr) {
        try {
            monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr);
            cal = UtilDateTime.toCalendar(null);
            cal.add(Calendar.MONTH, 0 - monthsInPastLimit);
            checkTime = UtilDateTime.toTimestamp(cal.getTime());
            searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr;
        } catch (Exception e) {
            // Ignore
        }
    }

    prods.each { oneProd ->
        oneInventory = [:];
        oneInventory.checkTime = checkTime;
        oneInventory.facilityId = facilityId;
        oneInventory.productId = oneProd.productId;
        oneInventory.minimumStock = oneProd.minimumStock as String;
        oneInventory.reorderQuantity = oneProd.reorderQuantity;
        oneInventory.daysToShip = oneProd.daysToShip;
        rows.add(oneInventory);
    }

}
context.inventoryByProduct = rows;
context.searchParameterString = searchParameterString;

-----------------------------------------END--------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: I need help in Invertory section in facility tab.

BJ Freeman
have you tried this on the demo server?
what is the URL?

gopalbi sent the following on 8/18/2008 4:20 AM:

> Hello friends,
>
>   please help me.
>
> When i go to Facility-->Facilities-->Inventoy Search option form. if i am
> putting productId like (WG-1111) then it show the exception like
> -------------------------------------****************------------------------
> :ERROR MESSAGE:
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://product/widget/facility/FacilityScreens.xml#ViewFacilityInventoryByProduct]:
> groovy.lang.MissingMethodException: No signature of method: static
> org.ofbiz.entity.condition.EntityCondition.makeCondition() is applicable for
> argument types: (java.lang.String, java.lang.Boolean,
> org.ofbiz.entity.condition.EntityOperator$8, java.lang.String,
> java.lang.Boolean) values: {"productId", true, LIKE, "WG-1111%", true} (No
> signature of method: static
> org.ofbiz.entity.condition.EntityCondition.makeCondition() is applicable for
> argument types: (java.lang.String, java.lang.Boolean,
> org.ofbiz.entity.condition.EntityOperator$8, java.lang.String,
> java.lang.Boolean) values: {"productId", true, LIKE, "WG-1111%", true})
>
> -------------------------------------*******************-------------------------------------
>
> I am sending you the groovy file which i am using. I am unable to find where
> is actual problem.But if i am trying with blank productId and then click to
> the Find button then it show the result.
>
>
>
>
> ---------------------------------------ViewFacilityInventoryByProduct.groovy-----------------
>
> import java.util.*
> import java.sql.Timestamp
> import org.ofbiz.base.util.*
> import org.ofbiz.entity.*
> import org.ofbiz.entity.condition.*
> import org.ofbiz.entity.transaction.*
> import org.ofbiz.entity.model.DynamicViewEntity
> import org.ofbiz.entity.model.ModelKeyMap
> import org.ofbiz.entity.util.EntityFindOptions
> import org.ofbiz.product.inventory.*
>
> action = request.getParameter("action");
>
> searchParameterString = "";
> searchParameterString = "action=Y&facilityId=" + facilityId;
>
> offsetQOH = -1;
> offsetATP = -1;
> hasOffsetQOH = false;
> hasOffsetATP = false;
>
> rows = [] as ArrayList;
>
> if (action) {
>     // ------------------------------
>     prodView = new DynamicViewEntity();
>     conditionMap = [facilityId : facilityId];
>
>     if (offsetQOHQty) {
>         try {
>             offsetQOH = Integer.parseInt(offsetQOHQty);
>             hasOffsetQOH = true;
>             searchParameterString = searchParameterString + "&offsetQOHQty="
> + offsetQOH;
>         } catch(NumberFormatException nfe) {
>         }
>     }
>     if (offsetATPQty) {
>         try {
>             offsetATP = Integer.parseInt(offsetATPQty);
>             hasOffsetATP = true;
>             searchParameterString = searchParameterString + "&offsetATPQty="
> + offsetATP;
>         } catch(NumberFormatException nfe) {
>         }
>     }
>
>     prodView.addMemberEntity("PRFA", "ProductFacility");
>     prodView.addAliasAll("PRFA", null);
>
>     prodView.addMemberEntity("PROD", "Product");
>     prodView.addViewLink("PROD", "PRFA", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("productId"));
>     prodView.addAlias("PROD", "internalName");
>     prodView.addAlias("PROD", "isVirtual");
>     prodView.addAlias("PROD", "salesDiscontinuationDate");
>     if (productTypeId) {
>         prodView.addAlias("PROD", "productTypeId");
>         conditionMap.productTypeId = productTypeId;
>         searchParameterString = searchParameterString + "&productTypeId=" +
> productTypeId;
>     }
>     if (searchInProductCategoryId) {
>         prodView.addMemberEntity("PRCA", "ProductCategoryMember");
>         prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("productId"));
>         prodView.addAlias("PRCA", "productCategoryId");
>         conditionMap.productCategoryId = searchInProductCategoryId;
>         searchParameterString = searchParameterString +
> "&searchInProductCategoryId=" + searchInProductCategoryId;
>     }
>
>     if (productSupplierId) {
>         prodView.addMemberEntity("SPPR", "SupplierProduct");
>         prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("productId"));
>         prodView.addAlias("SPPR", "partyId");
>         conditionMap.partyId = productSupplierId;
>         searchParameterString = searchParameterString +
> "&productSupplierId=" + productSupplierId;
>     }
>    
>     // set distinct on so we only get one row per product
>     findOpts = new EntityFindOptions(true,
> EntityFindOptions.TYPE_SCROLL_INSENSITIVE,
> EntityFindOptions.CONCUR_READ_ONLY, true);
>     searchCondition = EntityCondition.makeCondition(conditionMap,
> EntityOperator.AND);
>     notVirtualCondition =
> EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual",
> EntityOperator.EQUALS, null),
>                                                          EntityOperator.OR,
>                                                        
> EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"));
>
>     whereConditionsList = [searchCondition, notVirtualCondition];
>     // add the discontinuation date condition
>     if (productsSoldThruTimestamp) {
>         discontinuationDateCondition = EntityCondition.makeCondition(
>                [
>                 EntityCondition.makeCondition("salesDiscontinuationDate",
> EntityOperator.EQUALS, null),
>                 EntityCondition.makeCondition("salesDiscontinuationDate",
> EntityOperator.GREATER_THAN, productsSoldThruTimestamp)
>                ],
>                EntityOperator.OR);
>         whereConditionsList.add(discontinuationDateCondition);
>         searchParameterString = searchParameterString +
> "&productsSoldThruTimestamp=" + productsSoldThruTimestamp;
>     }
>
>     // add search on internal name
>     if (internalName) {
>        
> whereConditionsList.add(EntityCondition.makeCondition("internalName", true,
> EntityOperator.LIKE, "%" + internalName + "%", true));
>         searchParameterString = searchParameterString + "&internalName=" +
> internalName;
>     }
>    
>     // add search on productId
>     if (productId) {
>         whereConditionsList.add(EntityCondition.makeCondition("productId",
> true, EntityOperator.LIKE, productId + "%", true));
>         searchParameterString = searchParameterString + "&productId=" +
> productId;
>     }
>     whereCondition = EntityCondition.makeCondition(whereConditionsList,
> EntityOperator.AND);
>
>     beganTransaction = false;
>     List prods = null;
>     try {
>         beganTransaction = TransactionUtil.begin();
>         prodsEli = delegator.findListIteratorByCondition(prodView,
> whereCondition, null, null, ['productId'], findOpts);
>         prods = prodsEli.getCompleteList();
>         prodsEli.close();
>     } catch (GenericEntityException e) {
>         errMsg = "Failure in operation, rolling back transaction";
>         Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct");
>         try {
>             // only rollback the transaction if we started one...
>             TransactionUtil.rollback(beganTransaction, errMsg, e);
>         } catch (GenericEntityException e2) {
>             Debug.logError(e2, "Could not rollback transaction: " +
> e2.toString(), "ViewFacilityInventoryByProduct");
>         }
>         // after rolling back, rethrow the exception
>         throw e;
>     } finally {
>         // only commit the transaction if we started one... this will throw
> an exception if it fails
>         TransactionUtil.commit(beganTransaction);
>     }
>
>     // If the user has specified a number of months over which to sum usage
> quantities, define the correct timestamp
>     Timestamp checkTime = null;
>     monthsInPastLimitStr = request.getParameter("monthsInPastLimit");
>     if (monthsInPastLimitStr) {
>         try {
>             monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr);
>             cal = UtilDateTime.toCalendar(null);
>             cal.add(Calendar.MONTH, 0 - monthsInPastLimit);
>             checkTime = UtilDateTime.toTimestamp(cal.getTime());
>             searchParameterString += "&monthsInPastLimit=" +
> monthsInPastLimitStr;
>         } catch (Exception e) {
>             // Ignore
>         }
>     }
>
>     prods.each { oneProd ->
>         oneInventory = [:];
>         oneInventory.checkTime = checkTime;
>         oneInventory.facilityId = facilityId;
>         oneInventory.productId = oneProd.productId;
>         oneInventory.minimumStock = oneProd.minimumStock as String;
>         oneInventory.reorderQuantity = oneProd.reorderQuantity;
>         oneInventory.daysToShip = oneProd.daysToShip;
>         rows.add(oneInventory);
>     }
>
> }
> context.inventoryByProduct = rows;
> context.searchParameterString = searchParameterString;
>
> -----------------------------------------END--------------------------------------------
>
>

Reply | Threaded
Open this post in threaded view
|

Re: I need help in Invertory section in facility tab.

gopalbi
I am trying this on my local machine.the url is. But the problem is come in also demo server.

https://localhost:8443/facility/control/ViewFacilityInventoryByProduct


Thanks in Advance
Thanks & Regards:
Gopal Bisht

BJ Freeman wrote
have you tried this on the demo server?
what is the URL?

gopalbi sent the following on 8/18/2008 4:20 AM:
> Hello friends,
>
>   please help me.
>
> When i go to Facility-->Facilities-->Inventoy Search option form. if i am
> putting productId like (WG-1111) then it show the exception like
> -------------------------------------****************------------------------
> :ERROR MESSAGE:
> org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
> [component://product/widget/facility/FacilityScreens.xml#ViewFacilityInventoryByProduct]:
> groovy.lang.MissingMethodException: No signature of method: static
> org.ofbiz.entity.condition.EntityCondition.makeCondition() is applicable for
> argument types: (java.lang.String, java.lang.Boolean,
> org.ofbiz.entity.condition.EntityOperator$8, java.lang.String,
> java.lang.Boolean) values: {"productId", true, LIKE, "WG-1111%", true} (No
> signature of method: static
> org.ofbiz.entity.condition.EntityCondition.makeCondition() is applicable for
> argument types: (java.lang.String, java.lang.Boolean,
> org.ofbiz.entity.condition.EntityOperator$8, java.lang.String,
> java.lang.Boolean) values: {"productId", true, LIKE, "WG-1111%", true})
>
> -------------------------------------*******************-------------------------------------
>
> I am sending you the groovy file which i am using. I am unable to find where
> is actual problem.But if i am trying with blank productId and then click to
> the Find button then it show the result.
>
>
>
>
> ---------------------------------------ViewFacilityInventoryByProduct.groovy-----------------
>
> import java.util.*
> import java.sql.Timestamp
> import org.ofbiz.base.util.*
> import org.ofbiz.entity.*
> import org.ofbiz.entity.condition.*
> import org.ofbiz.entity.transaction.*
> import org.ofbiz.entity.model.DynamicViewEntity
> import org.ofbiz.entity.model.ModelKeyMap
> import org.ofbiz.entity.util.EntityFindOptions
> import org.ofbiz.product.inventory.*
>
> action = request.getParameter("action");
>
> searchParameterString = "";
> searchParameterString = "action=Y&facilityId=" + facilityId;
>
> offsetQOH = -1;
> offsetATP = -1;
> hasOffsetQOH = false;
> hasOffsetATP = false;
>
> rows = [] as ArrayList;
>
> if (action) {
>     // ------------------------------
>     prodView = new DynamicViewEntity();
>     conditionMap = [facilityId : facilityId];
>
>     if (offsetQOHQty) {
>         try {
>             offsetQOH = Integer.parseInt(offsetQOHQty);
>             hasOffsetQOH = true;
>             searchParameterString = searchParameterString + "&offsetQOHQty="
> + offsetQOH;
>         } catch(NumberFormatException nfe) {
>         }
>     }
>     if (offsetATPQty) {
>         try {
>             offsetATP = Integer.parseInt(offsetATPQty);
>             hasOffsetATP = true;
>             searchParameterString = searchParameterString + "&offsetATPQty="
> + offsetATP;
>         } catch(NumberFormatException nfe) {
>         }
>     }
>
>     prodView.addMemberEntity("PRFA", "ProductFacility");
>     prodView.addAliasAll("PRFA", null);
>
>     prodView.addMemberEntity("PROD", "Product");
>     prodView.addViewLink("PROD", "PRFA", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("productId"));
>     prodView.addAlias("PROD", "internalName");
>     prodView.addAlias("PROD", "isVirtual");
>     prodView.addAlias("PROD", "salesDiscontinuationDate");
>     if (productTypeId) {
>         prodView.addAlias("PROD", "productTypeId");
>         conditionMap.productTypeId = productTypeId;
>         searchParameterString = searchParameterString + "&productTypeId=" +
> productTypeId;
>     }
>     if (searchInProductCategoryId) {
>         prodView.addMemberEntity("PRCA", "ProductCategoryMember");
>         prodView.addViewLink("PRFA", "PRCA", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("productId"));
>         prodView.addAlias("PRCA", "productCategoryId");
>         conditionMap.productCategoryId = searchInProductCategoryId;
>         searchParameterString = searchParameterString +
> "&searchInProductCategoryId=" + searchInProductCategoryId;
>     }
>
>     if (productSupplierId) {
>         prodView.addMemberEntity("SPPR", "SupplierProduct");
>         prodView.addViewLink("PRFA", "SPPR", Boolean.FALSE,
> ModelKeyMap.makeKeyMapList("productId"));
>         prodView.addAlias("SPPR", "partyId");
>         conditionMap.partyId = productSupplierId;
>         searchParameterString = searchParameterString +
> "&productSupplierId=" + productSupplierId;
>     }
>    
>     // set distinct on so we only get one row per product
>     findOpts = new EntityFindOptions(true,
> EntityFindOptions.TYPE_SCROLL_INSENSITIVE,
> EntityFindOptions.CONCUR_READ_ONLY, true);
>     searchCondition = EntityCondition.makeCondition(conditionMap,
> EntityOperator.AND);
>     notVirtualCondition =
> EntityCondition.makeCondition(EntityCondition.makeCondition("isVirtual",
> EntityOperator.EQUALS, null),
>                                                          EntityOperator.OR,
>                                                        
> EntityCondition.makeCondition("isVirtual", EntityOperator.NOT_EQUAL, "Y"));
>
>     whereConditionsList = [searchCondition, notVirtualCondition];
>     // add the discontinuation date condition
>     if (productsSoldThruTimestamp) {
>         discontinuationDateCondition = EntityCondition.makeCondition(
>                [
>                 EntityCondition.makeCondition("salesDiscontinuationDate",
> EntityOperator.EQUALS, null),
>                 EntityCondition.makeCondition("salesDiscontinuationDate",
> EntityOperator.GREATER_THAN, productsSoldThruTimestamp)
>                ],
>                EntityOperator.OR);
>         whereConditionsList.add(discontinuationDateCondition);
>         searchParameterString = searchParameterString +
> "&productsSoldThruTimestamp=" + productsSoldThruTimestamp;
>     }
>
>     // add search on internal name
>     if (internalName) {
>        
> whereConditionsList.add(EntityCondition.makeCondition("internalName", true,
> EntityOperator.LIKE, "%" + internalName + "%", true));
>         searchParameterString = searchParameterString + "&internalName=" +
> internalName;
>     }
>    
>     // add search on productId
>     if (productId) {
>         whereConditionsList.add(EntityCondition.makeCondition("productId",
> true, EntityOperator.LIKE, productId + "%", true));
>         searchParameterString = searchParameterString + "&productId=" +
> productId;
>     }
>     whereCondition = EntityCondition.makeCondition(whereConditionsList,
> EntityOperator.AND);
>
>     beganTransaction = false;
>     List prods = null;
>     try {
>         beganTransaction = TransactionUtil.begin();
>         prodsEli = delegator.findListIteratorByCondition(prodView,
> whereCondition, null, null, ['productId'], findOpts);
>         prods = prodsEli.getCompleteList();
>         prodsEli.close();
>     } catch (GenericEntityException e) {
>         errMsg = "Failure in operation, rolling back transaction";
>         Debug.logError(e, errMsg, "ViewFacilityInventoryByProduct");
>         try {
>             // only rollback the transaction if we started one...
>             TransactionUtil.rollback(beganTransaction, errMsg, e);
>         } catch (GenericEntityException e2) {
>             Debug.logError(e2, "Could not rollback transaction: " +
> e2.toString(), "ViewFacilityInventoryByProduct");
>         }
>         // after rolling back, rethrow the exception
>         throw e;
>     } finally {
>         // only commit the transaction if we started one... this will throw
> an exception if it fails
>         TransactionUtil.commit(beganTransaction);
>     }
>
>     // If the user has specified a number of months over which to sum usage
> quantities, define the correct timestamp
>     Timestamp checkTime = null;
>     monthsInPastLimitStr = request.getParameter("monthsInPastLimit");
>     if (monthsInPastLimitStr) {
>         try {
>             monthsInPastLimit = Integer.parseInt(monthsInPastLimitStr);
>             cal = UtilDateTime.toCalendar(null);
>             cal.add(Calendar.MONTH, 0 - monthsInPastLimit);
>             checkTime = UtilDateTime.toTimestamp(cal.getTime());
>             searchParameterString += "&monthsInPastLimit=" +
> monthsInPastLimitStr;
>         } catch (Exception e) {
>             // Ignore
>         }
>     }
>
>     prods.each { oneProd ->
>         oneInventory = [:];
>         oneInventory.checkTime = checkTime;
>         oneInventory.facilityId = facilityId;
>         oneInventory.productId = oneProd.productId;
>         oneInventory.minimumStock = oneProd.minimumStock as String;
>         oneInventory.reorderQuantity = oneProd.reorderQuantity;
>         oneInventory.daysToShip = oneProd.daysToShip;
>         rows.add(oneInventory);
>     }
>
> }
> context.inventoryByProduct = rows;
> context.searchParameterString = searchParameterString;
>
> -----------------------------------------END--------------------------------------------
>
>