CATG_C CATG_NAME
------ ------------------------------------------------------------
P100O0 catg1
P30007 catg2
PCATG PCODE CAL_YEAR CAL_MONTH AMT_DR AMT_CR
------ ------ ------------- ------------- ------------- -------------
P10000 P10005 2008.000 1.000 .000 36000000.000
P10000 P10003 2008.000 2.000 .000 560000.000
P10000 P10002 2008.000 2.000 .000 133437.640
P10000 P10002 2008.000 3.000 .000 146048.974
P10000 P10003 2008.000 3.000 .000 288661.660
P10000 P10003 2008.000 4.000 .000 280000.000
P10000 P10003 2008.000 5.000 .000 280000.000
P10000 P10002 2008.000 5.000 .000 294609.664
P10000 P10003 2008.000 6.000 .000 280000.000
P10000 P10002 2008.000 7.000 .000 426840.612
P10000 P10003 2008.000 7.000 .000 280000.000
P10000 P10003 2008.000 8.000 .000 280000.000
P10000 P10003 2008.000 9.000 .000 280000.000
P10000 P10002 2008.000 9.000 .000 159187.257
P10000 P10003 2008.000 10.000 .000 280007.940
P10000 P10002 2008.000 10.000 .000 149168.977
P10000 P10003 2008.000 11.000 .000 284610.181
P10000 P10002 2008.000 11.000 .000 151189.127
P10000 P10001 2008.000 12.000 .000 161163.281
P10000 P10003 2008.000 12.000 .000 420194.000
P10000 P10002 2008.000 12.000 .000 296254.611
P30007 2008.000 .000 4560996.105 9620358.049
P30007 2008.000 .000 5557.680 2176453.514
P30007 2008.000 .000 10287670.753 57232.353
P30007 2008.000 1.000 1533020.295 4393879.028
P30007 2008.000 1.000 108798.239 .000
P30007 2008.000 2.000 107270.196 .000
P30007 2008.000 2.000 506.849 340271.340
P30007 2008.000 3.000 380796.417 .000
P30007 2008.000 3.000 7335.038 408199.990
P30007 2008.000 4.000 810559.309 24344.992
P30007 2008.000 4.000 34564.419 754345.507
P30007 2008.000 5.000 79928.859 .000
P30007 2008.000 5.000 112.201 127096.886
P30007 2008.000 6.000 8963.044 222952.271
P30007 2008.000 6.000 360968.836 .000
P30007 2008.000 7.000 168684.214 .000
P30007 2008.000 7.000 364852.028 379663.303
P30007 2008.000 8.000 154149.456 187317.515
P30007 2008.000 8.000 159241.700 .000
P30007 2008.000 9.000 384989.372 .000
P30007 2008.000 9.000 622.620 296899.485
P30007 2008.000 10.000 604.257 150284.588
P30007 2008.000 11.000 411.569 185889.068
P30007 2008.000 11.000 34045.272 .000
P30007 2008.000 12.000 21024.611 66384.480
based on the data above I want produce a report in this fashion
CATGCO CATGN OPBAL DR CURMNTHPUR CurMnthSale
------ ----- ------------- -- ------------- ------------
P10000 catg1 40553762.032 CR 877611.892
P30007 catg2 229460.839 DR 21024.611 66384.480
I will ask user to enter period of report in the format, YYYYMM.
Lets say the user enters 200812,
then for Column "opbal" , the report should sum abs("amt_dr-amt_cr") prior to "200812".
for Column "dr/cr", should display "DR", if the value of "opbal" is +positive, and "CR", is case the value of the "opbal" comes -negative.
for the Columns "curMnthPur" and "curMnthSale", the report should just
display the data for the current december("12") month.
ty in advance