CREATE OR REPLACE TABLE vn.ledgerCompany (
		`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
		`fiscalYear` int(10) unsigned NOT NULL COMMENT 'Año del ejercicio contable',
		`bookEntry` int(10) unsigned NOT NULL DEFAULT 1 COMMENT 'Contador asiento contable',
		PRIMARY KEY (`id`),
		UNIQUE KEY `ledgerCompany_unique` (`fiscalYear`)
	) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci 
	COMMENT='Contador para asientos contables';

	INSERT IGNORE INTO vn.ledgerCompany (fiscalYear, bookEntry)
		SELECT YEAR(util.VN_CURDATE()), lastBookEntry 
			FROM vn.ledgerConfig;
	
	ALTER TABLE  vn.ledgerConfig CHANGE IF EXISTS lastBookEntry lastBookEntry__ int(11) NOT NULL 
		COMMENT '@deprecated 2024-05-28 refs #7400 Modificar contador asientos contables';