Hi there, (removed cross-post)
On 22/12/2005, at 8:03 AM, Dev WO wrote:
so here's the method I'm using, it's within a framework. I'm using this to display my client with a page of all the "out of stock" product, and so he should have a negative virtual stock for the items...=========== public int virtualStockStatus() {// to generate the list of order not canceled nor already validated for shippingint virtualStockStatus = 0; // To initialize the virtual stock <...>NSArray orderItemsListToTakeIntoAccount = (NSArray) EOQualifier.filteredArrayWithQualifier(orderItemsList, qual);
// keep it simple
java.util.Enumeration en =
orderItemsListToTakeIntoAccount.objectEnumerator();
while(en.hasMoreElements()) {
CustomerOrderItem aCustomerOrderItem;
aCustomerOrderItem = (CustomerOrderItem)en.nextElement();
System.out.println("\n============\nQuantity requested: " +
aCustomerOrderItem.quantity());
System.out.println("\n============\nQuantity available: " +
aCustomerOrderItem.quantityAvailable());
if ( aCustomerOrderItem.quantity() != null && aCustomerOrderItem.quantity() > 0 ) {
if ( aCustomerOrderItem.quantityAvailable() != null ) {
// I think you'll want to add the available count rather than
subtract
// so that whether the availability is positive
or negative
// it will provide the status with the correct
number
virtualStockStatus += aCustomerOrderItem.quantityAvailable
().intValue();
}
virtualStockStatus -=
aCustomerOrderItem.quantity().intValue();
}
System.out.println("\n============\nVirtual stock: " +
virtualStockStatus);
}
return virtualStockStatus;
}
with regards,
--
Lachlan Deck
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
