logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > ASP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-09-2009, 03:24 PM   #1
kiwieur
 
Join Date: Apr 2009
Posts: 1
Question Running Sum

I have a recordset that pulls data from an access database based on certain criteria and therefore the number of rows displayed can vary from 1 to many.

2 of the fields in the recordset display the following data

Order Type
Order Qty

and an example would be

Row No. Order Type Order Qty
1 Top Up 10000
2 Call Off 5000
3 Call Off 3000

I also have a field from another recordset that displays the "Total Stock" value from the database

Now what I would like to do is have another field next to order qty named "Current Stock" and depending on the order type either add or subtracts values. This value would be calculated as follows using the example above


Order Type Order Qty Current Stock
Top Up 10000 =TotalStock + Row1 order qty
Call Off 5000 = row1 Currentstock - order qty
Call Off 3000 = row2 Currentstock - order qty

and so on

so the above example figures would be as shown below assuming that the "Total Stock Qty" is 12000


Order Type Order Qty Current Stock
Top Up 10000 22000
Call Off 5000 17000
Call Off 3000 14000

If anyone can help me at all I would appreciate it very much

Regards

Paul
kiwieur is offline   Reply With Quote
Old 04-12-2009, 08:34 PM   #2
mangofreak
mangofreak's Avatar
 
Join Date: Jan 2006
Location: Toronto-Canada
Posts: 444
Default

Is the sum being done dynamically when someone sells or orders from the stock?

I'm not sure I understand but I would do something like:

Code:
<%
Dim qty1, qty2, currentstock

qty1 = Request.QueryString(qty1)
qty2 = Request.QueryString(qty2)
currentstock = (qty1 - qty2)
%>

Then currentstock would go in your update from as a hidden field updating your currentstock

I may be way off but I would ned to understand your concept first.

Hope it helps, at least a little

Javier
__________________
J.
DW | FW | HTML | CSS | ASP | some PHP | Windows | Ubuntu
mangofreak is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:35 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com