compile function invoice_comm(Branch) begin condition pre: post: end condition declare function set_property, fieldcount, get_property, msg $insert logical ReturnVar = 0 Branches = 'DUE_DATE_DEF' convert ',' to @fm in Branches locate Branch in Branches using @fm setting Bpos then on Bpos gosub DueDateDefault end else Void = msg( '', 'Invalid Branch ':Bpos:' passed to order_comm' ) end return ReturnVar *===========================================================================* DueDateDefault: Terms = get_property( @window:'.TERMS', 'TEXT' ) convert ' ' to @fm in Terms begin case case num( Terms<1> ) and num( Terms<2> ) DaysToAdd = Terms<4> case num( Terms<2> ) DaysToAdd = Terms<2> case Terms = 'C.O.D.' DaysToAdd = 0 case Terms = 'Due Upon Recipt' DaysToAdd = 10 case otherwise$ DaysToAdd = 10 end case DayInt = iconv( get_property( @window:'.SHIP_DATE', 'TEXT' ), 'D' ) DayInt += DaysToAdd ReturnVar = DayInt return ReturnVar *============================================================================*