Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: tushar Kanvinde
  Where is tushar Kanvinde?
 Kolhapur, Maharastra
 India
 tushar Kanvinde
 To: joe Degorio
  Where is joe Degorio?
 Tacloban City
 Philippines
 joe Degorio
 Tags
Subject: RE: help with SQL command
Thread ID: 209381 Message ID: 209393 # Views: 1 # Ratings: 0
Version: Visual FoxPro 8 Category: Databases, Tables and SQL Server
Date: Sunday, December 28, 2008 10:13:42 AM         
   


> Hello Everyone,
> Can anybody share an idea\code to process with the following data sample...
>
>
> I would like to subtract the total Quantities of the same item product ID (e.g expiry_date.itemprod_id=4800289820865 which has the total of 5 qty let say I want to subtract 4) but must start deducting from the priority date 08/12/28. The expected result should be.....
> ****Itemprod_id************qty*******expiry*******lot_no
> 4800289820865***********1********09/01/10*****WING1000
>
> thanks in advance,
> joe

set order of table to product + expiry date and move pointer to first record with the itemcode

lnQtyReqd=4
DO WHILE lnQtyReqd>0
   lnCurrentQty=MIN(lnQtyReqd,QtyInTable)
   replace QtyInTable with QtyInTable-lnCurrentQty
   lnQtyReqd=lnQtyReqd-lnCurrentQty
   IF lnQtyReqd>0
      SKIP
      IF EOF()
         EXIT   && something wrong. QtyReqd is more that Qty in table
      ENDIF
   ENDIF
ENDDO


Regards
Tushar

ENTIRE THREAD

help with SQL command Posted by joe Degorio @ 12/28/2008 8:06:53 AM
RE: help with SQL command Posted by mike castillo @ 12/28/2008 8:35:35 AM
RE: help with SQL command Posted by joe Degorio @ 12/28/2008 12:42:08 PM
RE: help with SQL command Posted by mike castillo @ 12/29/2008 2:22:41 AM
RE: help with SQL command Posted by tushar @ 12/28/2008 10:13:42 AM
RE: help with SQL command Posted by joe Degorio @ 12/28/2008 12:44:53 PM
RE: help with SQL command Posted by Anders Altberg @ 12/28/2008 8:39:35 PM
RE: help with SQL command Posted by joe Degorio @ 12/29/2008 10:50:19 AM
RE: help with SQL command Posted by Jun Tangunan @ 12/29/2008 5:25:47 AM