[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

How to code a complicated report



Hello all! I have been writing SQR programs for about ten months now. We have an
Informix database platform with SQR 4.3.2 , UNIX Op Sys. I am writing a
complicated program for the accounting dept and I need help. The program
generates a report file that sums the month to date department totals (wages)
for hourly employees. Sounds simple right? Wrong! This is how the report should
look:


     101
     102  110  130  140  150  152  180   176  134  112  310etc...total of 24
columns
     109  111  131  141  151  153  181   177       113  310

Dept Reg  Mitt Sunday    Hol  Early                Min
                              Retire               Wage
                              Incentive       Adjust
                              Pay

3c1  319  555  738  837  2883 32737      9993      99438     8848      99893
3848
3c2  330  838  84849     4985 4858 484578     95495     9595      95965
54858     49595
3C4  4858 8585 85865     995  9966 8855  95968     95895     7577      734647
3646

etc...more depts


The numbers is bold are earnings codes. Those aren't printed on the report. I
just want to show the that I use different codes for each column. The earnings
codes have a month to date value associated with each row on the earnings_bal
table. I have to sum the month to date amount for each field for every
department. For example, the first column is the department field. The second
column contains the earnings codes for regular wages. The month to date regular
wages sum for dept 3c1 is 319, which is the sum of the month to date wages for
codes 101, 102 and 109. The third column contains the Mitt wages. The sum of
codes 110 and 111 are the Mitt wages. etc, etc,.  My question is, what is the
easiest way to code this program. Do I need to use arrays, load-lookup tables or
temp tables? I do know that it would be very inefficient to do 24 different
select statements and changing the line in the where clause that says "and erncd
in ('101','102','109') for each column.

The entire program is just an extract. The only calc's that I do are the sums.
Also, the number of depts that will end up on the report is unknown due to other
criteria such as, only hourly employees, not in a certain location, etc. But,
there will be exactly 24 columns across ( not including the dept column).


Thanks in advance!