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

[sqr-users] Printing heading and total at end using On-Break



Hi again,

I have requirment like this.

Cust name: XXXX
mar  apr   may  jun
Total
Cust name: XXXX
mar  apr   may  jun
Total

currently I am using following code

!--------------------------------------------
begin-select on-error=record_sql_error
($sql-error,'MAJOR',$sql_report,'main_query')
crmserv.descr         &desc=char ()  on-break level=1
print=never before=comp_proc after=write_file_summary
crmserv.priority      &priority
crmserv.open          &open=NUMBER
crmserv.inprogress    &inprogress=NUMBER
crmserv.pending       &pending=NUMBER
crmserv.closed        &closed=NUMBER
crmserv.cancelled     &cancelled=NUMBER
crmserv.otherstat     &otherstat=NUMBER

  move  &desc              to $desc
  move  &priority          to $priority
  move  &open              to $open
  move  &inprogress        to $inprogress
  move  &pending           to $pending
  move  &closed            to $closed
  move  &cancelled         to $cancelled
  move  &otherstat         to $otherstat

  add 1 to #llopp

  add &open        to #opentot
  add &inprogress  to #inprogresstot
  add &pending     to #pendingtot
  add &closed      to #closedtot
  add &cancelled   to #cancelledtot
  add &otherstat   to #otherstattot

  do write_file_detail
  do print_report_detail

from 
[$from_clause]
where 1=1
end-select
end-procedure ! main_query

begin-procedure write_file_summary
! Create the output record
  let $record = ' '
  move #opentot         to  $opentot
  move #inprogresstot   to  $inprogresstot
  move #pendingtot      to  $pendingtot
  move #closedtot       to  $closedtot
  move #cancelledtot    to  $cancelledtot
  move #otherstattot    to  $otherstattot

  string 'TOTAL' $opentot $inprogresstot $pendingtot
$closedtot $cancelledtot $otherstattot by $tab into
$record

  ! Output the summary record.
  if ($p_create_xls = 'Y')
    do write_string_to_ascii_file (#xls_file_number,
$record)
  end-if
 
  if ($p_create_pdf = 'Y')
   do write_string_to_ascii_file (#pdf_file_number,
$record)
  end-if

end-procedure ! write_file_summary

begin-procedure comp_proc
  if #notfirstRow = 0  ! this will only happen the
first time the procedure is executed
     move 1 to #notFirstRow ! 1 is true
     write 1 from 'Company : ' &desc
  else
     write 1 from 'Company : ' &desc
     new-page
  end-if
end-procedure !corp_proc

!-----------------------------------------------
If I use this code I am getting like 


Cust name: XXXX
mar  apr   may  jun
Total
Cust name: XXXX
mar  apr   may  jun
Total

But second Total gives total of both customers. While
I want total for individual customers. 

Please suggest where I'm missing something.

Thanks in advance....

Darshil


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users