Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Sold Qty
Message
From
27/11/2010 05:47:54
Sharath Shetty
Sri Krishna Consultancy Services
Mumbai, India
 
 
To
26/11/2010 14:10:45
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01490599
Message ID:
01490659
Views:
41
>Dear Experts
>
>I have following data
>
>
>&& opening stock table
>create  cursor open_stock (dates d(8),codes c(4),products c(15),qty n(3),sold n(3),rate n(8,2),amount n(9,2))
>insert into open_stock values({^2010-07-01},'1401','Hard Disk',1,0,1100,0)
>replace all amount with qty*rate
>
>&& purchase table
>create  cursor purchase (dates d(8),codes c(4),products c(15),qty n(3),sold n(3),rate n(8,2),amount n(9,2))
>insert into purchase values({^2010-07-01},'1401','Hard Disk',2,0,1200,0)
>insert into purchase values({^2010-07-02},'1401','Hard Disk',3,0,1300,0)
>insert into purchase values({^2010-07-03},'1401','Hard Disk',4,0,1400,0)
>insert into purchase values({^2010-07-03},'1401','Hard Disk',8,0,1500,0)
>replace all amount with qty*rate
>
>&& sale table
>create  cursor sales (dates d(8),codes c(4),products c(15),qty n(3))
>insert into sales values({^2010-07-01},'1401','Hard Disk',2)
>insert into sales values({^2010-07-04},'1401','Hard Disk',5)
>
>
>It display following result as figure 1
>
>----------------
>Opening Qty=1
>Purchased Qty=17
>Total Qty=18
>----------------
>Sold QTY=7
>----------------
>
>Now I want to filled sold column in both dbf's (open_stock & purchase) as as figure 2
>
>Please help

u r figure 2 is missing
index Open_stock & Purchase      (Date+Code)

Select Purchase
INDEX ON  DTOS(DATE)+Code TAG DATE

Select Open_Stock
INDEX ON  Substr(Dtos(Date),1,6)+Code TAG DATE

Select Sales
set relation into Substr(Dtos(Date),1,6)+Code to Open_Stock,  DTOS(DATE)+Code  to  Purchase

SCAN
 Replace Sold With Sold +Sales.Sold in Purchase 
 Replace Sold With Sold +Sales.Sold in Open_Stock
ENDSCAN
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform