122 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			122 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| compile function PROD_SPEC_RPT1()
 | |
| begin condition
 | |
| pre:
 | |
| post:
 | |
| end condition
 | |
| declare function getprinterlist, getprofilestring, writeprofilestring, extdevicemode
 | |
| declare function msg, set_property, send_event, dialog_box, utility, get_property
 | |
| declare function set_printer
 | |
| declare subroutine rlist, or_view, activate_save_select, yield, update_index
 | |
| $insert rlist_equates
 | |
| $insert msg_equates
 | |
| 
 | |
| Params = dialog_box( 'PROD_SPEC_RPT1', @window, '*CENTER' )
 | |
| if Params = 'CANCEL' or Params = '' then
 | |
|     return 0
 | |
| end
 | |
| open 'SYSLISTS' to SysListsTable else
 | |
|     MsgInfo = ''
 | |
|     MsgInfo<mcol$> = -2
 | |
|     MsgInfo<mrow$> = -2
 | |
|     MsgInfo<mtext$> = 'Unable to open SYSLISTS...' 
 | |
|     Void = msg( '', MsgInfo )
 | |
|     return 0
 | |
| end
 | |
| ListsId = 'PROD_SPEC_RPT1*':@station
 | |
| write '' on SysListsTable, ListsId else
 | |
|     MsgInfo = ''
 | |
|     MsgInfo<mcol$> = -2
 | |
|     MsgInfo<mrow$> = -2
 | |
|     MsgInfo<mtext$> = 'Unable to clear SYSLISTS ':ListsId:'...'
 | |
|     Void = msg( '', MsgInfo )
 | |
|     return 0
 | |
| end
 | |
| convert '*' to @fm in Params
 | |
| Custs    = Params<1>
 | |
| Active       = Params<2>
 | |
| Inactive     = Params<3>
 | |
| DirToPrinter = Params<4>
 | |
| 
 | |
| Stmt = 'SELECT PROD_SPEC'
 | |
| if Custs then
 | |
|     swap @vm with "' '" in Custs
 | |
|     Custs = "'":Custs:"'"
 | |
|     Stmt := ' WITH CUST_ID = ':Custs
 | |
| end
 | |
| 
 | |
| StatusStmt   = ''
 | |
| if Active and Inactive then
 | |
|    * they selected both status' so do nothing
 | |
| end else
 | |
|    if Active then
 | |
|       if Custs then
 | |
|          StatusStmt = ' AND WITH STATUS = "A" '
 | |
|       end else
 | |
|          StatusStmt = ' WITH STATUS = "A" '      
 | |
|       end 
 | |
|    end
 | |
|    if Inactive then
 | |
|       if Custs then
 | |
|          StatusStmt = ' AND WITH STATUS = "I" '
 | |
|       end else
 | |
|          StatusStmt = ' WITH STATUS = "I" '         
 | |
|       end 
 | |
|    end
 | |
| end
 | |
| 
 | |
| Stat = utility( 'CURSOR', 'H' )
 | |
| 
 | |
| Stmt := StatusStmt
 | |
| 
 | |
| rlist( Stmt, target_savelist$, ListsId, '', '' )
 | |
| 
 | |
| activate_save_select( ListsId )
 | |
| 
 | |
| if @reccount then
 | |
|    Cmd = "LIST PROD_SPEC JUSTLEN '5' CUST_NAME JUSTLEN '26' STATUS JUSTLEN '8' SPEC_NUM JUSTLEN '16' PART_NUM JUSTLEN '16' REV_NUM JUSTLEN '4' COLHEAD 'Rev#' "
 | |
|    Cmd:= "BY CUST_NAME BY STATUS BY SPEC_NUM BY-DSND REV_NUM"
 | |
|    Cmd:= " HEADING ":'"':" Customer Product Specifications 'TL'"
 | |
|    Cmd:= " PAGE #  'P'  by Customer/Status/Spec Number/Descending Rev# ":'"'
 | |
|    if DirToPrinter = 'Yes' then
 | |
|        rlist( Cmd, 0, '', '', '' )
 | |
|    end else
 | |
|        or_view( '', Cmd )
 | |
|        Void = set_property( 'ORPRV.PRINT', 'ENABLED', 0 )
 | |
|        WinId = 'ORPRV'
 | |
|        loop
 | |
|          while get_property( WinId, 'HANDLE' )
 | |
|           yield()
 | |
|        repeat
 | |
|        ToPrint = ''
 | |
|        MsgInfo = ''
 | |
|        MsgInfo<mtext$> = 'Do you want to print this report?'
 | |
|        MsgInfo<micon$> = '?'
 | |
|        MsgInfo<mtype$> = 'BNY'
 | |
|        MsgInfo<mcol$>  = -2
 | |
|        MsgInfo<mrow$>  = -2
 | |
|        MsgInfo<mdefbtn$> = 2 ;* default to no
 | |
|        ToPrint = msg( @window, MsgInfo )
 | |
|        if ToPrint then
 | |
|           activate_save_select( ListsId )
 | |
|           rlist( Cmd, 0, '', '', '' )
 | |
|        end
 | |
|    end 
 | |
| end else
 | |
|    MsgInfo = ''
 | |
|    MsgInfo<mcol$>  = -2
 | |
|    MsgInfo<mrow$>  = -2   
 | |
|    MsgInfo<mtext$> = 'NO Records meeting your date criteria!!'
 | |
|    MsgInfo<micon$> = '!'
 | |
|    Void = MSG( '', MsgInfo )
 | |
| end
 | |
| write '' on SysListsTable, ListsId else
 | |
|     MsgInfo = ''
 | |
|     MsgInfo<mcol$>  = -2
 | |
|     MsgInfo<mrow$>  = -2
 | |
|     MsgInfo<mtext$> = 'Unable to clear SYSLISTS ':ListsId:'...'    
 | |
|     Void = msg( '', MsgInfo )
 | |
|     return 0
 | |
| end
 | |
| return 0
 | |
| 
 |