open-insight/LSL2/OIEVENT/READ/INVOICE..json
2024-03-25 15:12:53 -07:00

11 lines
2.8 KiB
JSON

{
"header": {
"version": 1,
"type": "record"
},
"body": {
"record1": {
"<1>": "declare subroutine forward_event, security_err_msg\r\ndeclare function company_comm, msg, security_check, post_event, rowexists\r\ndeclare function fieldcount, scroll_enable\r\n\r\n$insert logical\r\n$insert security_rights_equ\r\n$insert msg_equates\r\n\r\nNewRecord = false$\r\nif rowexists( 'INVOICE', .invoice_no->text ) then\r\n ReadOk = true$\r\nend else\r\n * security check is done from the order\r\n * cannot create an invoice unless going through order\r\n if get_property( @window, '@AutoCreate' ) then\r\n ReadOk = true$ \r\n end else\r\n MsgInfo = ''\r\n MsgInfo<mtext$> = 'You can only create invoices from order.'\r\n MsgInfo<micon$> = 'H'\r\n Void = msg( '', MsgInfo )\t \r\n\t ReadOk = false$\r\n\t .order_no->text = ''\r\n\t Void = post_event( CtrlEntId, 'CLEAR', False$, True$ )\r\n end\r\n NewRecord = true$\r\nend\r\nif ReadOk then\r\n if get_property( @window, '@NoRead' ) then\r\n Void = set_property( @window, '@NoRead', 0 )\r\n end else\r\n * no qbf active do the read\r\n * if it is active the read already took place\r\n forward_event()\r\n end\r\n Void = set_property( @window, '@OrigInvoiceDetail', .invoice_detail->array )\r\n InvoiceNo = .invoice_no->text\r\n ProtectVar = 'ENTRY_ID/ENTRY_DATE/STATUS/CUST_NO/CUST_NAME/CUST_DIVISION/'\r\n ProtectVar:= 'PO/ORDER_NO/WAF_SIZE/PLANT'\r\n swap '/' with @rm:@window:'.' in ProtectVar\r\n ProtectVar = @window:'.':ProtectVar\r\n Void = set_property( ProtectVar, 'ENABLED', 0 )\r\n if rowexists( 'INVOICE', InvoiceNo ) else\r\n .entry_id->text = oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )\r\n .entry_date->text = oconv( date(), 'D2/' ) \r\n end \r\n if NewRecord else\r\n\t if security_check( 'Invoice', Edit$ ) else\r\n\t * protect all fields\r\n\t AllControls = utility( 'OBJECTLIST', @window, '' )\r\n\t Acnt = fieldcount( AllControls, @fm ) \r\n\t for i = 1 to Acnt \r\n\t ThisControl = AllControls<i>\r\n\t if ThisControl[-6,6] = '_LABEL' or index( ThisControl, 'MENU', 1 ) or index( ThisControl, 'TEXT', 1 ) else\r\n\t void = set_property( ThisControl, 'ENABLED', 0 )\r\n\t end \r\n\t next i \r\n\t .print_invoice->enabled = 1\r\n\t * WAS A TEMPORARY FIX CAUSE OF SHIPPING AND RECEIVING IN TEMPE AND DARLA IN MESA\r\n\t *if @user4 = 'MIKE_M' or @user4 = 'LINDA_R' then\r\n\t * .tracking_no->enabled = 1\r\n\t * .force_update->enabled = 1\r\n\t * .box_cnt->enabled = 1\r\n\t *end\r\n\t Void = scroll_enable()\r\n\t end\r\n end\r\nend\r\n\r\nRETURN 0"
}
}
}