*-------------------------------------------------------------*;
* Program: wreportdialog.scl                                  *;  
* Description: Show the generated report on dialog            *;  
* By: An Truong, 11/26/2007                                   *;  
*-------------------------------------------------------------*;  
entry optional=titlelst:list  
               sublst:list  
               conlst:list  
               header $100 footer $100;  
 
INIT:
   control asis;  
 
   *** Check for license ***;  
   length licerr 8;  
   call display('_license.scl',licerr);  
   if licerr = 1 then return ;  
 
   *** Verify if the dataroot path exist ***;  
   cur_os = symget('sysscpl');  
   if index(cur_os,'WIN_') > 0 or index(cur_os,'XP') > 0 or index(cur_os,'NET') > 0 then  
      slash = "\";  
   else slash = "/";  
 
   *** Create the form ***;  
   applib = symget('applib');  
   appbroker = symget('appbroker');  
   appservice = symget('appservice');  
   rc = preview ('clear');  

   submit;  
   <table cellpadding="0" cellspacing="0" id="table3">  
   <tr>  
      <td align="left" style="background:transparent url(../syvalidate/images/new_top_left1.gif) 
         no-repeat left; width:8px;height:28px;">  
      </td>  
      <td style="background:transparent url(../syvalidate/images/new_top1.gif) 
         repeat-x left; height:28px;">&header</td>  
      <td align="right" style="background:transparent url(../syvalidate/images/new_top_right1.gif) 
         repeat-x left; width:8px; height:28px;">  
      </td>  
   </tr>  
   <tr>  
      <td background="../syvalidate/images/new_bar_left1.gif"></td>  
      <td >  
         <table class="contentDlg" cellpadding="0" cellspacing="0" id="table1" 
            align="center" style="border-collapse: collapse; margin-top: 20px; 
            margin-bottom: 20px; margin-left: 20px; margin-right: 20px">  
            <tr>  
               <td align="center">  
               <table cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="table2">  
 
   endsubmit;  
 
   *** sign and title ***;  
   do i =1 to listlen(titlelst);  
      t_title = getitemc(titlelst, i);  
      sign = compress(scan(t_title, 1, '|'));  
      titlestr = trim(left(scan(t_title, 2, '|')));  

      *** Sign ***;  
      if sign = 'ok' then do;  
         icon ='<img border="0" src="../syvalidate/images/icon_ok.gif">';  
      end;  
      else if sign = 'error' then do;  
         icon = '<img border="0" src="../syvalidate/images/icon_error.gif">';  
      end;  
      else if sign = 'warning' then do;  
         icon = '<img border="0" src="../syvalidate/images/icon_warning.gif">';  
      end;  
 
      *** title ***;  
      str1 = scan(titlestr,1,'-');  
      str2 = scan(titlestr,2,'-');  
 
      submit;  
            	<tr>  
                  <td><p align="right">&icon</p></td>  
                  <td><b>&str1</b> - &str2</td>  
               </tr>  
      endsubmit;  
   end; *** end loop ***;  
 
   submit;  
               </table>  
               </td>  
            </tr>  
            <tr>  
            <td align="center">  
   endsubmit;  
 
   if listlen(sublst) > 0 then do;  
      submit;  
            <table cellpadding="5" cellspacing="0" style="border-collapse: collapse" id="table2" bgcolor="#FFFFCC">  
      endsubmit;  
 
      do i = 1 to listlen(sublst);  
         subject = getitemc(sublst, i);  
         content= getitemc(conlst, i);  
 
         submit;  
 
            <tr>  
               <td><p align="right"><b>&subject</b></p></td>  
               <td>&content</td>  
            </tr>  
         endsubmit;  
      end;  
   end;  
   submit;  
         </table>  
         </td>  
      </tr>  
      <tr>  
         <td align="center">  &nbsp;</td>  
      </tr>  
      <tr>  
         <td align="center">   
            <button id="hider0" onclick="closeDlg('dlgContent')" style="width: 60px" id="btnSubmit" type="button">  
            <table cellpadding="0" cellspacing="0" class="TextBtn">  
            <tr>  
               <td align="right" valign="middle">  
                  <img border="0" src="../syvalidate/images/back_12.gif"></td>  
               <td align="left" valign="middle">&nbsp;Back</td>  
            </tr>  
            </table>
            </button>  
         </td>  
      </tr>  
      </table>  
      </td>  
      <td background="../syvalidate/images/new_bar_right1.gif"></td>  
   </tr>  
   <tr>  
      <td align="left" style="background:transparent url(../syvalidate/images/new_bottom_left1.gif) 
         repeat-x left; width:8px; height:26px;">  
      </td>  
      <td style="background:transparent url(../syvalidate/images/new_bottom1.gif) 
         repeat-x left; height:26px;">&footer</td>  
      <td style="background:transparent url(../syvalidate/images/new_bottom_right1.gif) 
         repeat-x left; width:8px; height:26px;" align="right">  
      </td>  
   </tr>  
   </table>  
   endsubmit;  
 
   rc = preview ('file','_WEBOUT');  
   rc = preview ('clear');  
return;  
 
TERM:  
   if titlelst ne . then rc = dellist(titlelst);  
   if sublst ne . then rc = dellist(sublst);  
   if conlst ne . then rc = dellist(conlst);  
return;