• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: signed int
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >signed int (From: Dev WO <email@hidden>)
 >Re: signed int (From: "Jerry W. Walker" <email@hidden>)
 >Re: signed int (From: Dev WO <email@hidden>)

  • Prev by Date: In memory qualification issues
  • Next by Date: Re: In memory qualification issues
  • Previous by thread: Re: signed int
  • Next by thread: Re: signed int
  • Index(es):
    • Date
    • Thread