{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function security_check, msg, send_event, fieldcount, Get_Status\r\ndeclare subroutine forward_event, security_err_msg, obj_Schedule,ErrMsg, Set_Status\r\n\r\n$insert security_rights_equ\r\n\r\n* Equates for columns in invoice detail control\r\n\r\nequ Item$        to 1\r\nequ QuoteNo$     to 2\r\nequ SchedNo$     to 3\r\nequ Wo$          to 4\r\nequ PartNo$      to 5\r\nequ LotNo$       to 6\r\nequ GLAcct$      to 7\r\nequ Setup$       to 8\r\nequ Srp$         to 9\r\nequ Qty$         to 10\r\nequ Rejects$     to 11\r\nequ Unprocessed$ to 12\r\nequ Price$       to 13\r\nequ Amount$      to 14\r\nequ PSN$         to 15\r\nequ WafInv$      to 16\r\n\r\n\r\nIF security_check( 'Invoice', Delete$ ) THEN\r\n\r\n\tInvNo\t\t= Get_Property(@WINDOW,'ID')\r\n\tTrackNos\t= Get_Property(@WINDOW:'.TRACKING_NO','ARRAY')\r\n\t\r\n\tSWAP @vm:@vm WITH '' IN TrackNos\r\n\tIF TrackNos[-1,1] = @vm THEN TrackNos[-1,1] = ''\r\n\tSWAP @vm WITH ', ' in TrackNos \r\n\t\r\n\tShipVia\t\t= Get_Property(@WINDOW:'.SHIP_VIA','TEXT')\r\n\tBoxCnt\t\t= Get_Property(@WINDOW:'.BOX_CNT','TEXT')\r\n\tShipDt\t\t= Get_Property(@WINDOW:'.SHIP_DATE','TEXT')\r\n\t\r\n\tInvoiceDetList = Get_Property(@WINDOW:'.INVOICE_DETAIL','LIST')\t;* Returns ARRAY propert\r\n\t\r\n\tDeletedRows = ''\r\n\tFOR I = 1 TO COUNT(InvoiceDetList,@FM) + (InvoiceDetList NE '')\r\n\t\tSchedNo = InvoiceDetList<I,3>\r\n\t\tIF SchedNo NE '' THEN\r\n\t\t\tobj_Schedule('RemInvoice',InvNo:@RM:SchedNo)\t;* Remove references to this invoice\r\n\t\t\tIF Get_Status(errCode) THEN\r\n\t\t\t\tErrMsg(errCode)\r\n\t\t\t\tSet_Status(0)\r\n\t\t\t\tFOR N = 1 TO COUNT(DeletedRows,@FM) + (DeletedRows NE '')\r\n\t\t\t\t\t\r\n\t\t\t\t\tSchedKey\t\t= DeletedRows<N,SchedNo$>\r\n\t\t\t\t\tSetupCharge\t\t= DeletedRows<N,Setup$>\r\n\t\t\t\t\tSRPCharge\t\t= DeletedRows<N,Srp$>\r\n\t\t\t\t\tShipQty\t\t\t= DeletedRows<N,Qty$>\r\n\t\t\t\t\tShipPrice\t\t= DeletedRows<N,Price$>\r\n\t\t\t\t\tRejects\t\t\t= DeletedRows<N,Rejects$>\r\n\t\t\t\t\tUnprocessed\t\t= DeletedRows<N,Unprocessed$>\r\n\r\n\t\t\t\t\tParms  = InvNo:@RM:SchedKey:@RM:SetupCharge:@RM:SRPCharge:@RM:ShipQty:@RM:ShipPrice:@RM\r\n\t\t\t\t\tParms := ShipVia:@RM:Rejects:@RM:Unprocessed:@RM:BoxCnt:@RM:TrackNos:ShipDt\r\n\t\t\t\t\t\r\n\t\t\t\t\tobj_Schedule('AddInvoice',Parms)\t;* Restore invoice information on Schedules\r\n\t\t\t\t\t\r\n\t\t\t\t\tRETURN\r\n\t\t\t\t\t\r\n\t\t\t\tNEXT N\r\n\t\t\t\t\r\n\t\t\tEND ELSE\r\n\t\t\t\tDeletedRows<-1> = InvoiceDetList<I>\r\n\t\t\tEND\r\n\t\tEND\t;* End of check for null sched number\r\n\tNEXT I\r\n\r\n   forward_event()\r\n   AllControls = utility( 'OBJECTLIST', @window, '' )\r\n   Acnt = fieldcount( AllControls, @fm )     \r\n   for i = 1 to Acnt         \r\n      ThisControl = AllControls<i>\r\n      if ThisControl[-6,6] = '_LABEL' or index( ThisControl, 'MENU', 1 ) or index( ThisControl, 'TEXT', 1 ) else\r\n         void = set_property( ThisControl, 'ENABLED', 1 )\r\n      end           \r\n   next i \r\nend else\r\n   security_err_msg( 'Invoice', Delete$ )\r\nend\r\nRETURN 0"
        }
    }
}