55 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| compile subroutine order_srl_fields_valid(ConvType, DataIo, Branch, ReturnedValue)
 | |
| begin condition
 | |
| pre:
 | |
| post:
 | |
| end condition
 | |
| declare function msg, get_property, set_property
 | |
| declare subroutine extract_si_keys
 | |
| 
 | |
| $insert logical
 | |
| $insert quote_srl_equ
 | |
| $insert msg_equates
 | |
| 
 | |
| equ valid$         to 0    ;* successful
 | |
| equ invalid_msg$   to 1    ;* bad data       -   print error message window
 | |
| equ invalid_conv$  to 2    ;* bad conversion -          "         "
 | |
| equ invalid_nomsg$ to 3    ;* bad but do not print the error message window
 | |
| equ CrLf$          to char(13):char(10)
 | |
| 
 | |
| ReturnedValue = DataIo       
 | |
| status() = Valid$
 | |
| * WO, PO
 | |
| begin case
 | |
|     case Branch = 'WO'
 | |
|         TextOut = 'Work Order number '
 | |
|     case Branch = 'PO'
 | |
|         TextOut = 'Purchase Order number '
 | |
| end case
 | |
| begin case
 | |
|    case ConvType = 'ICONV'
 | |
|       if Branch = 'PO' and DataIo = 'PROCUREMENT CARD' then
 | |
|           ReturnedValue = DataIo
 | |
|       end else
 | |
| 	      extract_si_keys( 'ORDER_SRL', Branch, DataIo, Keys )
 | |
| 	      OrderNo = get_property( @window:'.ORDER_NO', 'TEXT' )
 | |
| 	      locate OrderNo in Keys using @vm setting Fpos then
 | |
| 	          keys = delete( Keys, 1, Fpos, 0 )
 | |
| 	      end
 | |
| 	      if Keys then
 | |
| 	          swap @vm with ', ' in Keys
 | |
| 	          MsgInfo = ''
 | |
| 	          MsgInfo<mtext$> = TextOut:' ':Quote(DataIo):' has been used in order_srl number ':CrLf$:Keys
 | |
| 	          MsgInfo<micon$> = 'H'
 | |
| 	          Void = msg( '', MsgInfo )
 | |
| 	          status() = invalid_nomsg$
 | |
| 	      end
 | |
| 	  end
 | |
|    case ConvType = 'OCONV'
 | |
|       * no output
 | |
|       ReturnedValue = DataIo
 | |
|    case otherwise$
 | |
|       ReturnedValue = ''
 | |
|       status() = invalid_conv$
 | |
| end case
 | |
| return
 |