{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function security_check, set_printer, get_printer, msg, fieldcount, Printer_Select\r\ndeclare subroutine security_err_msg\r\n$insert security_rights_equ\r\n$insert oiprint_equates\r\n$insert msg_equates\r\nequ CocNo$    to 1\r\nequ CustNo$   to 2\r\nequ CustName$ to 3\r\nequ Division$ to 4\r\nequ Po$       to 5\r\nequ Wo$       to 6\r\nequ Shipment$ to 7\r\nif security_check( 'COC', Print$ ) then\r\n   * pull off variables\r\n   TextFields = 'COC_NO/CUST_NO/CUST_NAME/DIVISION/PO/WO/SHIPMENT'\r\n   swap '/' with @rm:@window:'.' in TextFields\r\n   TextFields = @window:'.':TextFields\r\n   TextFields = get_property( TextFields, 'TEXT' )\r\n   convert @rm to @fm in TextFields\r\n   CocNo  = TextFields<CocNo$>\r\n   CustNo = TextFields<CustNo$>\r\n   CustName = TextFields<CustName$>\r\n   Division = TextFields<Division$>\r\n   Po       = TextFields<Po$>\r\n   Wo       = TextFields<Wo$>\r\n   Shipment = TextFields<Shipment$>\r\n   ShipDetail = .ship_detail->array\r\n   \r\n   PrintPath = Printer_Select('',1)\t\t;* Get default printer path\r\n   Stat = set_printer( 'INIT', '', '', '':@fm:'':@fm:0:@fm:'', 0 ,'',PrintPath)\r\n   gosub CheckErr\r\n   Font = \"Courier New,12,L,1\"\r\n   convert ',' to @fm in Font\r\n   Hf = Font\r\n   Stat = set_printer( 'FONT', Font )\r\n   gosub CheckErr\r\n   gosub PrintToF\r\n   Font<2> = 9\r\n   Font<4> = 0\r\n   Void = set_printer( 'FONT', Font )\r\n   gosub CheckErr\r\n   Void = set_printer( 'TEXT', '' )\r\n   Table = ''\r\n   Table<1> = 'Order No,Line,RDS No,Part Num,Lot Num,R#,Rejects,Qty'\r\n   Rcnt = fieldcount( ShipDetail<1>, @vm )\r\n   for i = 1 to Rcnt\r\n       Table<-1> = ShipDetail<1,i>:',':ShipDetail<2,i>:',':ShipDetail<3,i>:',':ShipDetail<4,i>:',':ShipDetail<5,i>:',':ShipDetail<6,i>:',':ShipDetail<7,i>:',':ShipDetail<8,i>\r\n   next i\r\n   convert ',' to @vm in Table\r\n   ColSizeInfo = '<+1440':@vm:'<+720':@vm:'<+1440':@vm:'<+2160':@vm:'<+2160':@vm:'>+720':@vm:'>+720':@vm:'>+720'\r\n   x = set_printer( \"ADDTABLE\", ColSizeInfo, '', Table, '', '', 1, TB_ALL )\r\n   *x = Set_Printer(\"TABLE\", Table, '', 1:@fm:.5:@fm:1:@fm:1.5:@fm:1.5:@fm:.5:@fm:.5:@fm:.5, 'L':@fm:'L':@fm:'L':@fm:'L':@fm:'L':@fm:'L':@fm:'R':@fm:'R', TB_ALL)\r\n   Table = ',,,,,,,'\r\n   convert ',' to @vm in Table\r\n   Table<1,7> = .tot_rej->array<1,1>\r\n   Table<1,8> = .tot_qty->array<1,1>\r\n   x = set_printer( \"ADDTABLE\", ColSizeInfo, '', Table, '', '', 1, TB_TOP )\r\n   stat = set_printer( 'TERM' )       \r\n   gosub CheckErr   \r\nend else\r\n   security_err_msg( 'COC', Print$ )\r\nend\r\nRETURN 0\r\n*===========================================================================*\r\nPrintTof:\r\n   LineOut = ''\r\n   LineOut = fmt( 'Coc No: ':CocNo, 'L#25' ):'Entry Date: ':.entry_date->text\r\n   Void = set_printer( 'TEXT', LineOut )\r\n   LineOut = fmt( 'Cust No: ':CustNo, 'L#14' ):'  '\r\n   LineOut:= fmt( 'Name: ':CustName, 'L#35' ):'  '\r\n   LineOut:= 'Division: ':Division\r\n   Void = set_printer( 'TEXT', LineOut )\r\n   LineOut = fmt( 'PO#: ':Po, 'L#29' ):'  '\r\n   LineOut:= fmt( 'WO#: ':Wo, 'L#25' ):'  '\r\n   LineOut:= 'Shipment: ':Shipment\r\n   Void = set_printer( 'TEXT', LineOut )\r\nreturn \r\n\r\n*===========================================================================*\r\nCheckErr:\r\n    if stat < 0 then\r\n        goto FatalExit\r\n    end\r\nreturn \r\n\r\n*===========================================================================*\r\nFatalExit:\r\n    Void = msg( '', Stat )\r\n    Stat = set_printer( 'TERM' )\r\nreturn \r\n\r\n*===========================================================================*"
        }
    }
}