James,
This might help to give you the right idea:
Set strictdate to 0
Set Date to mdy
Create Cursor trs(id i, orgamt y,payment y, date d)
Insert into Trs values (1,250.00, 10.00, {01/01/01})
Insert into Trs values (1,250.00, 15.00, {02/01/01})
Insert into Trs values (1,250.00, 10.00, {03/01/01} )
cWho=1
Select all ;
T1.id, ;
T1.orgamt, ;
T1.payment, ;
T1.orgamt - sum(T2.payment) as balance;
from Trs T1 ;
join Trs T2 on T1.id=T2.id ;
and T1.date>=T2.date ;
group by T1.id,T1.orgamt, T1.date ;
where T1.id=?cwho ;
Into Cursor curTemp
Browse
Dave Crozier
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of James E Harvey
Sent: 23 February 2007 16:38
To: 'ProFox Email List'
Subject: Running balance
We want to create a grid that "simulates" the look of an Excel file that has
a column that is a "running" total of two other columns.
I can't make this work in a grid using the table itself, so I'm trying to
create a cursor to use as the data source of the grid.
Table structure is:
Pk_cash auto increment primary key
Date_serv date
Comp_id c 3
Dep_dis n 11 2
Type_entry c 3
Sample data:
1
02/01/2007
SHS
1,000.00
DEP
2
02/01/2007
SHS
500.00
DIS
3
02/02/2007
SHS
2,000.00
DEP
4
02/03/2007
SHS
200.00
DIS
Results desired in the grid:
Date Deposits Disbursements Balance
02/01/2007 1,000.00 1,000.00
02/01/2007 500.00 500.00
02/02/2007 2,000.00 2,500.00
02/03/2007 200.00 2,300.00
The grid is read only, data will be added, edited in typical form with text
boxes.
The select below is missing the "running balance" column, and nothing I've
tried has worked.
SELECT cb.pk_cash, cb.date_serv,
SUM(IIF(cb.type_entry="DEP",cb.dep_dis,0000000.00)) as deposit,
SUM(IIF(cb.type_entry="DIS",cb.dep_dis,0000000.00)) as disburse FROM
cashbal cb WHERE cb.COMP_ID = 'SHS' GROUP BY cb.pk_cash, cb.date_serv ORDER
BY cb.date_serv
James E Harvey
Hanover Shoe Farms, Inc.
M.I.S./Corresponding Officer
Off: 717-637-8931
fax: 717-637-6766
email: [EMAIL PROTECTED]
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.