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

Re: ONBREAK--TOTALS



Don,

Here's a simple program showing a single-level on-break.

Ray

   begin-program
   do main
   end-program

   begin-procedure main
   move 0 to #total
   begin-select
   item_type &item_type (1,1) on-break
      level=1 before=before_item_type after=after_item_type
   xref_amt &xref_amt (,11) edit 99,999
      add &xref_amt to #item_type_subtotal
      add &xref_amt to #total
      next-listing
   from item
   order by item_type
   end-select
   print 'Total' (1,1)
   print #total (,11) edit 99,999
   end-procedure

   begin-procedure before_item_type
   move 0 to #item_type_subtotal
   end-procedure

   begin-procedure after_item_type
   print 'Subtotal' (1,1)
   print #item_type_subtotal (,11) edit 99,999
   next-listing skiplines=1
   end-procedure

Here's the output:

   A              3
                  7
                  2
   Subtotal      12

   B              6
                  9
   Subtotal      15

   C             32
                  6
   Subtotal      38

   Total         65

> DOES ANY ONE HELP ME IN TOTALING FOR ONBREAK
>
> eg:
>
>
>   item_types    xref_amt
>
>       A           $3
>       A           $7
>       A           $2
>       B           $6
>       B           $9
>       C           $32
>       C           $6
> I need to know the sub-totals for each item_types(A,B,C) on-break
> and grand totals for all item_types
>
>   thanks in advance
>
>
> _______________________________________________________________
> Get Free Email and Do More On The Web. Visit http://www.msn.com
>

----------------------------------------------------------------------
Ray Ontko       |  Ray Ontko & Co  |  "RO&C: data movers and shakers."
rayo@ontko.com  |  Richmond, In    |  See us at http://www.ontko.com/