-- Permit receipts (سندات القبض والمطالبات المالية): legacy AqabaTCS entity PERMITSRECEIPTS. Translates the ACTIVE rows of the legacy -- STATUS_ACTION_MATRIX (NTP schema) into GRAINS_SCREEN_PERMISSIONS keys. Primary (NAFITHTCS) schema. Safe to re-run; not run by the app. SU needs no rows. -- -- receipts the list and the receipt page (SEARCH / VIEW): AC, AM, QUEUE_OP, SAP, TENDER_SUP, YM -- receipts.create CREATE: QUEUE_OP, TENDER_SUP -- receipts.confirm CONFIRM: QUEUE_OP, SAP, TENDER_SUP (NOT_RECEIVED -> RECEIVED) -- receipts.update UPDATE: TENDER_SUP (RECEIVED / UNPAID) -- receipts.paid PAID: QUEUE_OP, SAP, TENDER_SUP (UNPAID -> PAID + a cash receipt) -- receipts.print PRINT: QUEUE_OP, SAP, TENDER_SUP -- receipts.revokeRequest REVOKE to PENDING_RVKD: QUEUE_OP (and SU) (RECEIVED / UNPAID, waits for approval) -- receipts.revoke REVOKE to RVKD: TENDER_SUP (RECEIVED / UNPAID) -- receipts.revokeAudited REVOKE AUDITED: SAP, TENDER_SUP -- receipts.acceptRevoke / receipts.rejectRevoke: TENDER_SUP (PENDING_RVKD) -- receipts.audit AUDIT / FIN_AUDIT: AM, SAP, TENDER_SUP (AC has the legacy AUDIT row but the legacy code has no status list for it: it failed, so it gets no key) -- receipts.report REPORT: AC, AM, QUEUE_OP, SAP, TENDER_SUP -- Generated 2026-11-25; change a row to change who may do what. INSERT INTO GRAINS_SCREEN_PERMISSIONS (ROLECODE, RESOURCE_KEY) SELECT v.rolecode, v.resource_key FROM ( SELECT 'AC' AS rolecode, 'receipts' AS resource_key FROM dual UNION ALL SELECT 'AM' AS rolecode, 'receipts' AS resource_key FROM dual UNION ALL SELECT 'QUEUE_OP' AS rolecode, 'receipts' AS resource_key FROM dual UNION ALL SELECT 'SAP' AS rolecode, 'receipts' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts' AS resource_key FROM dual UNION ALL SELECT 'YM' AS rolecode, 'receipts' AS resource_key FROM dual UNION ALL SELECT 'QUEUE_OP' AS rolecode, 'receipts.create' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.create' AS resource_key FROM dual UNION ALL SELECT 'QUEUE_OP' AS rolecode, 'receipts.confirm' AS resource_key FROM dual UNION ALL SELECT 'SAP' AS rolecode, 'receipts.confirm' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.confirm' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.update' AS resource_key FROM dual UNION ALL SELECT 'QUEUE_OP' AS rolecode, 'receipts.paid' AS resource_key FROM dual UNION ALL SELECT 'SAP' AS rolecode, 'receipts.paid' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.paid' AS resource_key FROM dual UNION ALL SELECT 'QUEUE_OP' AS rolecode, 'receipts.print' AS resource_key FROM dual UNION ALL SELECT 'SAP' AS rolecode, 'receipts.print' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.print' AS resource_key FROM dual UNION ALL SELECT 'QUEUE_OP' AS rolecode, 'receipts.revokeRequest' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.revoke' AS resource_key FROM dual UNION ALL SELECT 'SAP' AS rolecode, 'receipts.revokeAudited' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.revokeAudited' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.acceptRevoke' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.rejectRevoke' AS resource_key FROM dual UNION ALL SELECT 'AM' AS rolecode, 'receipts.audit' AS resource_key FROM dual UNION ALL SELECT 'SAP' AS rolecode, 'receipts.audit' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.audit' AS resource_key FROM dual UNION ALL SELECT 'AC' AS rolecode, 'receipts.report' AS resource_key FROM dual UNION ALL SELECT 'AM' AS rolecode, 'receipts.report' AS resource_key FROM dual UNION ALL SELECT 'QUEUE_OP' AS rolecode, 'receipts.report' AS resource_key FROM dual UNION ALL SELECT 'SAP' AS rolecode, 'receipts.report' AS resource_key FROM dual UNION ALL SELECT 'TENDER_SUP' AS rolecode, 'receipts.report' AS resource_key FROM dual ) v WHERE NOT EXISTS (SELECT 1 FROM GRAINS_SCREEN_PERMISSIONS p WHERE p.ROLECODE = v.rolecode AND p.RESOURCE_KEY = v.resource_key); COMMIT;