-- 013_einvoice_menu.sql
-- v0.6 (2026-05-07)
-- 전자세금계산서 메뉴 등록 (출고/정산 그룹 9000400 아래)

BEGIN;

DO $$
BEGIN
  IF NOT EXISTS (SELECT 1 FROM menu_info WHERE objid = 9000404) THEN
    INSERT INTO menu_info (objid, menu_type, parent_obj_id, menu_name_kor, menu_name_eng,
                           seq, menu_url, status, system_name, regdate)
    VALUES (9000404, '1', 9000400, '전자세금계산서', 'eTax Invoice',
            13, '/m/admin/einvoices', 'active', 'PMS', NOW());
  ELSE
    UPDATE menu_info
       SET parent_obj_id  = 9000400,
           menu_name_kor  = '전자세금계산서',
           menu_name_eng  = 'eTax Invoice',
           menu_url       = '/m/admin/einvoices',
           status         = 'active'
     WHERE objid = 9000404;
  END IF;
END $$;

COMMIT;
