open-insight/LSL2/STPROC/WIN_INVOICE_CM_VALID.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

40 lines
1.3 KiB
Plaintext

compile subroutine WIN_INVOICE_CM_VALID(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition
$insert logical
$insert invoice_equ
$insert msg_equates
declare function msg, get_property, set_property
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)
* this validates the invoice cm number in windows like car
ReturnedValue = DataIo
status() = Valid$
*
begin case
case ConvType = 'ICONV'
CurCust = get_property( @window:'.CUST_NO', 'TEXT' )
InvRec = xlate( 'INVOICE', DataIo, '', 'X' )
if ( DataIo[1,2] = 'CM' ) and ( CurCust = InvRec<invoice_cust_no$> ) else
MsgInfo = ''
MsgInfo<mtext$> = DataIo:' is not a VALID Credit Memo for ':oconv( CurCust, '[XLATE_CONV,COMPANY*CO_NAME]' )
MsgInfo<micon$> = 'H'
Void = msg( '', MsgInfo )
status() = invalid_nomsg$
end
case ConvType = 'OCONV'
* no output
ReturnedValue = DataIo
case otherwise$
ReturnedValue = ''
status() = invalid_conv$
end case
return