document number sequence
This commit is contained in:
@@ -1128,6 +1128,38 @@ CREATE TABLE IF NOT EXISTS `td_payment_item` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||
", 'td_payment_item');
|
||||
|
||||
run_ddl("
|
||||
CREATE TABLE IF NOT EXISTS `document_types` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`company_id` int(11) NOT NULL DEFAULT 0,
|
||||
`doc_type_key` varchar(50) NOT NULL DEFAULT '',
|
||||
`name` varchar(100) NOT NULL DEFAULT '',
|
||||
`prefix` varchar(20) NOT NULL DEFAULT '',
|
||||
`format_type` enum('YY','YYMM','YYMMDD','none') NOT NULL DEFAULT 'YYMM',
|
||||
`sequence_digits` tinyint(2) unsigned NOT NULL DEFAULT 5,
|
||||
`allow_manual` tinyint(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uq_company_doctype_prefix` (`company_id`, `doc_type_key`, `prefix`),
|
||||
KEY `company_id` (`company_id`),
|
||||
KEY `doc_type_key` (`doc_type_key`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||
", 'document_types');
|
||||
|
||||
run_ddl("
|
||||
CREATE TABLE IF NOT EXISTS `document_number_sequences` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`company_id` int(11) NOT NULL DEFAULT 0,
|
||||
`prefix` varchar(20) NOT NULL DEFAULT '',
|
||||
`format_type` enum('YY','YYMM','YYMMDD','none') NOT NULL DEFAULT 'YYMM',
|
||||
`year` smallint(4) unsigned NOT NULL DEFAULT 0,
|
||||
`month` tinyint(2) unsigned NOT NULL DEFAULT 0,
|
||||
`day` tinyint(2) unsigned NOT NULL DEFAULT 0,
|
||||
`last_sequence` int(11) unsigned NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uq_scope` (`company_id`, `prefix`, `format_type`, `year`, `month`, `day`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||
", 'document_number_sequences');
|
||||
|
||||
// ── Summary ───────────────────────────────────────────────────────────────────
|
||||
$total = $ok_count + $skip_count + $err_count;
|
||||
echo "\n\033[1m=== Done ===\033[0m\n";
|
||||
|
||||
Reference in New Issue
Block a user