{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function msg, send_message, fieldcount\r\ndeclare subroutine extract_si_keys\r\n$insert invoice_equ\r\n$insert logical\r\n$insert wafer_inv_equ\r\n$insert msg_equates\r\nequ WIPos$ to 6\r\n\r\nSelPos = .order_detail->selpos\r\nCurCol = SelPos<1>\r\nCurRow = SelPos<2>\r\nOrderLine = CurRow\r\n* IF THIS ORDER LINE ITEM HAS BEEN INVOICED THEN DO NOT ALLOW DELETION OF THE ROW\r\nOrderNo = .order_no->text\r\nInvoiced = false$\r\nextract_si_keys(\"INVOICE\", \"ORDER_NO\", OrderNo, KeyList)\r\nKCnt = fieldcount( KeyList, @vm )\r\nfor i = 1 to KCnt\r\n   ThisInv = KeyList<1,i>\r\n   OrderLineItems = xlate( 'INVOICE', ThisInv, invoice_order_line_item$, 'X' )\r\n   locate OrderLine in OrderLineItems using @vm setting LPos then\r\n      Invoiced = true$\r\n   end\r\n  until Invoiced\r\nnext i\r\nif Invoiced then\r\n   Void = send_message( @window:'.ORDER_DETAIL', 'INSERT', RowNum, RowData )\r\n   SelPos = .order_detail->selpos\r\n   SelPos<2> = SelPos<2> - 1\r\n   .order_detail->selpos = SelPos\r\n   MsgInfo = ''\r\n   MsgInfo<mtext$> = 'This order line item has already been inoviced...deletion is not allowed.'\r\n   MsgInfo<micon$> = 'H'\r\n   Void = msg( '', MsgInfo )\r\n   return 0\r\nend \r\nWaferInvId = RowData<1,6>\r\nWIRec = xlate( 'WAFER_INV', WaferInvId, '', 'X' )\r\nOrdNo = .order_no->text\r\nWIOrdNos = WIRec<wafer_inv_order_no$>\r\nlocate OrdNo in WIOrdNos using @vm setting FPos then\r\n   MsgInfo = ''\r\n   MsgInfo<mtext$> = 'You will need to manually adjust wafer inventory# ':WaferInvId\r\n   MsgInfo<micon$> = '!'\r\n   Void = msg( '', MsgInfo )\r\nend\r\nRETURN 1"
        }
    }
}