Skip to main content
Skip table of contents

SQL - Reset Company Processes

Description

SQL used to reset the Company Process control screen

Usage

Used to allow client to rerun Company DO processes after failed run

First piece is all that is needed to reset FI process and allow rerun of processes
Includes re-open of Accounting Date if closed
Includes deleting batch_groups if necessary

SQL

CODE
--Reset FI so that process can be run again
UPDATE
	bg
SET
	latest_due_date_fi = NULL
FROM
	batch_groups bg
	JOIN company_codes cc ON cc.id = bg.company_code_id
WHERE
	bg.accounting_date = '8-2-2021'		-- Accounting Date
	AND cc.number = '200'				-- Company Number
	AND latest_due_date_fi IS NOT NULL;

--Re-open Accounting Date
UPDATE
	ad
SET
	status = 'open'
FROM
	accounting_dates ad
	JOIN company_codes cc ON cc.id = ad.company_code_id
WHERE
	cc.number = '200'					-- Company Number
	AND ad. [date] = '08-02-2021';		-- Accounting Date

--Delete Batch Group so you can start from scratch
DELETE bp FROM batch_groups bg
JOIN batch_processes bp ON bp.batch_group_id = bg.id
JOIN company_codes cc ON cc.id = bg.company_code_id
WHERE bg.accounting_date = '8-2-2021'   -- Accounting Date
	AND cc.number = '200'				-- Company Number
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.