--库存 采购 总账 会计期 是否打开脚本
SELECT closing_status
INTO v_inv_period_status
FROM gl_period_statuses_v gp
WHERE application_id = 101
AND set_of_books_id = 2021
AND closing_status <> 'N'
AND trunc(SYSDATE) BETWEEN start_date AND end_date;
IF v_inv_period_status <> 'O' THEN
message_error('总账会计期间未打开');
END IF;
SELECT gps.closing_status
INTO v_po_period_status
FROM gl_period_statuses gps
WHERE adjustment_period_flag = 'N'
AND ((closing_status) IN
(SELECT lookup_code
FROM ap_lookup_codes
WHERE application_id = '201'
AND set_of_books_id = v_set_of_books_id))
AND trunc(SYSDATE) BETWEEN start_date AND end_date;
IF v_po_period_status <> 'O' THEN
message_error('采购会计期间未打开');
END IF;
BEGIN
SELECT 1
INTO v_gl_period_status
FROM org_acct_periods_v
WHERE (rec_type = 'ORG_PERIOD' AND organization_id = :parameter.org_id)
AND trunc(SYSDATE) BETWEEN start_date AND end_date;
EXCEPTION
WHEN no_data_found THEN
message_error('库存会计期间未打开');
END;