H DFTACTGRP(*NO) BNDDIR('ERPGSDK')                                                             
      **********************************************************************                        
     FCART1     IF   E           K DISK    USROPN                                                   
     FITEMPF    IF   E           K DISK    USROPN                                                   
      ****************************************************************                              
      * Prototypes                                                   *                              
      ****************************************************************                              
      /COPY QCOPYSRC,P.ERPGSDK                                                                      
      ****************************************************************                              
     D DftPath         S             64    INZ('/www/erpgsdk/catalog+                               
     D                                          /templates/')                                       
      *                                                                                             
      * Data read in from Web Page                                                                  
     D user            S             30                                                             
      *                                                                                             
      * Work variables                                                                              
     D DidWrite        S               N                                                            
     D ExtPrice        S             13  2                                                          
     D Total           S             15  2                                                          
      **********************************************************************                        
     C                   callp     #startup                                                         
      *                                                                                             
     C                   EXSR      $Input                                                           
      *                                                                                             
     C                   callp     #setPath(DftPath)                                                
     C                   callp     #loadTemplate('cartssi.erpg')                                    
      *                                                                                             
     C                   callp     #writeThisSec('first')                                           
     C                   EXSR      $Cart                                                            
     C                   EXSR      $Last                                                            
      *                                                                                             
     C                   callp     #cleanup                                                         
      *                                                                                             
     C                   SETON                                        LR                            
      ****************************************************************                              
      * List Main Catalogs                                           *                              
      ****************************************************************                              
     C     $Cart         BEGSR                                                                      
      *                                                                                             
     C                   eval      Total = 0                                                        
     C                   callp     #loadSection('cart')                                             
      *                                                                                             
     C                   OPEN      CART1                                99                          
     C                   OPEN      ITEMPF                               98                          
      *                                                                                             
     C                   if        (not *IN99)                                                      
      *                                                                                             
     C     user          SETLL     CART1                                                            
     C     user          READE     CART1                                                            
      *                                                                                             
     C                   dow       (not %eof(CART1))                                                
     C                   callp     #replaceData('/%prod%/':SCPROD)                                  
      *                                                                                             
     C                   if        (not *IN98)                                                      
     C     SCPROD        CHAIN     ITEMPF                                                           
      *                                                                                             
     C                   if        (not %found(ITEMPF))                                             
     C                   eval      ITIDESC = 'Not Found!'                                           
     C                   eval      ITPRICE = 0                                                      
     C                   endif                                                                      
      *                                                                                             
     C                   else                                                                       
     C                   eval      ITIDESC = 'File Error!'                                          
     C                   endif                                                                      
      *                                                                                             
     C                   eval      ExtPrice = (ITPRICE * SCQTY)                                     
     C                   eval      Total = (Total + ExtPrice)                                       
     C                   callp     #replaceData('/%proddesc%/':ITIDESC)                             
     C                   callp     #replaceData('/%qty%/':%editc(SCQTY:'Z'))                        
     C                   callp     #replaceData('/%price%/':%editc(ITPRICE:'L'))                    
     C                   callp     #replaceData('/%extprice%/':                                     
     C                                           %editc(ExtPrice:'L'))                              
     C                   callp     #writeSection                                                    
      *                                                                                             
     C                   eval      DidWrite = *ON                                                   
     C     user          READE     CART1                                                            
     C                   enddo                                                                      
      *                                                                                             
     C                   if        (not DidWrite)                                                   
     C                   callp     #writeThisSec('empty')                                           
     C                   endif                                                                      
      *                                                                                             
     C                   CLOSE     CART1                                                            
     C                   else                                                                       
     C                   callp     #writeThisSec('fileerror')                                       
     C                   endif                                                                      
      *                                                                                             
     C                   if        (not *IN98)                                                      
     C                   CLOSE     ITEMPF                                                           
     C                   endif                                                                      
      *                                                                                             
     C                   ENDSR                                                                      
      ****************************************************************                              
      * Write Last part of Cart                                      *                              
      ****************************************************************                              
     C     $Last         BEGSR                                                                      
      *                                                                                             
     C                   callp     #loadSection('last')                                             
     C                   callp     #replaceData('/%total%/':%editc(Total:'L'))                      
     C                   callp     #writeSection                                                    
      *                                                                                             
     C                   ENDSR                                                                      
      ****************************************************************                              
      * Read Input from web page                                     *                              
      ****************************************************************                              
     C     $Input        BEGSR                                                                      
      *                                                                                             
     C                   eval      user = #getCookie('user')                                        
      *                                                                                             
     C                   ENDSR