Re: signed int
Re: signed int
- Subject: Re: signed int
- From: Lachlan Deck <email@hidden>
- Date: Thu, 22 Dec 2005 09:20:40 +1100
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 shipping
int 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
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden