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

Printing on the top of the page



     This is my region subtotal routine.  It prints after each region
     detail section, which can be anywhere from one to ten pages.  I need
     to print this subtotal on the TOP OF EVERY corresponding detail page.
     I will really appreciate any help I can get - I can't figure this one
     out.
     Thank you very much!
     Yana

     !**************************************************************
     begin-procedure REGION-TOTAL-SUM
      print $region                             (+1,1,15)
        move 0 to #AMT-IN
       move 1 to #i
       while #i < 3
         get #AMT from region-total-sum(#i)
        add #AMT to #AMT-IN
         do
     Format_Currency_Amt(#AMT-IN,$report-currency,$AsOfToday,'B99,999,999.9
     9mi',$amt,'I')
        print $amt                      (0,49,18)
         array-add #AMT TO grand-total-sum(#i)
        add #AMT to #cust-grand-total
        add #AMT to #AMT-TOTAL
         put 0 into region-total-sum(#i)
         add 1 to #i
       end-while
       while #i > 2 and #i < 6
        move 0 to #AMT-IN
         get #AMT from region-total-sum(#i)
      do
     Format_Currency_Amt(#AMT,$report-currency,$AsOfToday,'B99,999,999.99mi
     ',$amt,'I')
        if #i = 3
                print $amt              (0,67,18)

        else
                print $amt              (0,0,18)

        end-if
         array-add #AMT TO grand-total-sum(#i)
        add #AMT to #cust-grand-total
         put 0 into region-total-sum(#i)
     put $region #AMT into region-sum(#i)
         add 1 to #i
       end-while
        if #region-cust-total <> 0
                        let #AMT-TOTAL-IN = (#AMT-TOTAL * 100) /
     #region-cust-total
                let #AMT-TOTAL-IN = TRUNC(#AMT-TOTAL-IN,1)
        end-if
        do
     Format_Currency_Amt(#region-cust-total,$report-currency,$AsOfToday,'B9
     9,999,999.99mi',$amt,'I')
        print $amt                      (0,+2,18)

        print #AMT-TOTAL-IN             (0,145,6) edit 9999.9
        print '%'                       (0,151,1)
        move 0 to #AMT-TOTAL
        move 0 to #region-cust-total

     end-procedure

     !********************************************************************