Reputation: 47
I have to find next open accounting period for certain period.
Suppose, on invoice, accounting period is Feb 2022, then first check if accounting period has closed. If closed, I have to find next open accounting period.
Is there saved search formula or any other approach please advice.
Upvotes: 0
Views: 87
Reputation: 311
If you prefer SQL this can get you started...
SELECT
accountingperiod.id AS accountingperiod_id,
MIN(startdate) AS min_startdate,
ROW_NUMBER() OVER (
ORDER BY
MIN(startdate) ASC
) AS rownum
FROM
accountingperiod
WHERE
1 = 1
AND isinactive = 'F'
AND closed = 'F'
AND isyear = 'F'
AND isquarter = 'F'
GROUP BY
accountingperiod.id
ORDER BY
min_startdate ASC
FETCH FIRST
1 ROW ONLY
Upvotes: 0
Reputation: 15447
In my experience NetSuite itself will attempt to assign the closest open period to a transaction based on the transaction date.
e.g. If you are entering a vendor bill from 3 months ago you'd enter the correct date on the bill (now - 3 months) but only last month is still open NetSuite will assign last month as the accounting period.
Upvotes: 2