Is this a one-time need on an existing dataset, or something that happensas
users input data?
This happens after a data import occurs. User gets data from a
portfolio management system and imports it into the database -
"tblTaxGainLoss". No user input besides the import is needed. this
data gives the portfolio manager a sense of what stocks to sell and
what to keep.
Here is what the data looks like after import:
(Data is sorted by Client_number)
ID Clien_number Client_name TotalGainLoss stock quantity date
unit_cost price GainLoss Value Percent Sold
1 6303s Christina Stansell, Irrevocable Trust 15797.48 wfmi 100 27-
Apr-07 47.5272 10.56 -3696.72 1056 -0.7778114427107
2 6303s Christina Stansell, Irrevocable Trust 15797.48 mer 100 30-
Jan-06 74.64 19.49 -5515 1949 -0.738879957127546
3 6303s Christina Stansell, Irrevocable Trust 15797.48 c 100 15-Nov-04
46.7 14.21 -3249 1421 -0.695717344753747
4 6303s Christina Stansell, Irrevocable Trust 15797.48 ebay 100 27-
Apr-07 34.39 15.5471 -1884.29 1554.71 -0.547917999418436
5 6303s Christina Stansell, Irrevocable Trust 15797.48 fo 100 23-
Nov-05 79.87 39.49 -4038 3949 -0.505571553774884
6 6303s Christina Stansell, Irrevocable Trust 15797.48 wy 100 24-
Jun-05 65.25 35.35 -2990 3535 -0.45823754789272
7 6303s Christina Stansell, Irrevocable Trust 15797.48 ebay 200 27-
Sep-06 27.2182 15.5471 -2334.22 3109.42 -0.428797642753746
8 6303s Christina Stansell, Irrevocable Trust 15797.48 wmb 200 16-
Jul-08 34.51 20.44 -2814 4088 -0.407707910750507
9 6303s Christina Stansell, Irrevocable Trust 15797.48 xlf 400 07-
May-08 27.14 16.24 -4360 6496 -0.401621223286662
10 6303s Christina Stansell, Irrevocable Trust 15797.48 adbe 200 27-
Apr-07 42.77 28.63 -2828 5726 -0.330605564648118
11 6303s Christina Stansell, Irrevocable Trust 15797.48 spy 240 14-
Jan-08 140.95 99.46 -9957.6 23870.4 -0.294359702021994
12 6303s Christina Stansell, Irrevocable Trust 15797.48 xlnx 400 08-
Jan-07 24.318 17.82 -2599.2 7128 -0.267209474463361
13 6303s Christina Stansell, Irrevocable Trust 15797.48 intc 100 16-
Jul-08 20.888 15.84 -504.8 1584 -0.241669858291842
14 6303s Christina Stansell, Irrevocable Trust 15797.48 wye 200 02-
Feb-05 39.32 34.17 -1030 6834 -0.130976602238047
15 6303s Christina Stansell, Irrevocable Trust 15797.48 jnj 100 24-
Apr-02 64.56 61.5 -306 6150 -4.73977695167287E-02
16 6303s Christina Stansell, Irrevocable Trust 15797.48 d 200 10-
Aug-05 37.845 36.2 -328.999999999999 7240 -4.34667723609459E-02
17 6303s Christina Stansell, Irrevocable Trust 15797.48 nqlr -1 22-
Oct-08 0.2599 0.38 -0.1201 -0.38 0.462100808003078
18 6303s Christina Stansell, Irrevocable Trust 15797.48 yaakk -1 17-
Oct-08 1.7299 5.5 -3.7701 -5.5 2.17937453031967
The TotalGainLoss Column represents the year-to-date G\L figures for
the account and the "GainLoss" column represents the G\L for the
position (stock/option) held in the account.
The Portfolio manager takes the original "TotalGainLoss" number and
adds it to the "GainLoss" and comes up with a total. That total is
then moved to the next row of the "TotalGainLoss" and then added to
the "GainLoss" in the current row....and so on.
In the first example posted....the original "TotalGainloss" is
15797.48 and it is added to the "GainLoss" of -3696.72 to get a total
of 12100.76.
In the next row the "TotalGaonLoss" should be replaced with the total
from the previous row (12100.76) and it should be added to the
"GainLoss" to get another total.....and so on....