Files
orderPRO/database/migrations/20260315_000050_create_receipt_configs_table.sql
Jacek Pyziak ed057fc304 feat(08-10-receipt-module): phases 08-10 complete — receipt issuing from orders
Phase 08 — DB Foundation:
- 3 new tables: receipt_configs, receipts, receipt_number_counters
- company_settings extended with BDO, REGON, KRS, logo fields

Phase 09 — Receipt Config:
- CRUD for receipt configurations (Settings > Accounting)
- ReceiptConfigController + ReceiptConfigRepository

Phase 10 — Receipt Issuing:
- ReceiptRepository with atomic numbering (INSERT ON DUPLICATE KEY UPDATE)
- ReceiptController with snapshot pattern (seller/buyer/items as JSON)
- "Wystaw paragon" button in order view
- Documents tab showing both receipts and marketplace documents
- Activity log entry on receipt creation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 19:49:06 +01:00

14 lines
767 B
SQL

CREATE TABLE IF NOT EXISTS `receipt_configs` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(128) NOT NULL,
`is_active` TINYINT(1) NOT NULL DEFAULT 1,
`number_format` VARCHAR(64) NOT NULL DEFAULT 'PAR/%N/%M/%Y',
`numbering_type` ENUM('monthly','yearly') NOT NULL DEFAULT 'monthly',
`is_named` TINYINT(1) NOT NULL DEFAULT 0,
`sale_date_source` ENUM('order_date','payment_date','issue_date') NOT NULL DEFAULT 'issue_date',
`order_reference` ENUM('none','orderpro','integration') NOT NULL DEFAULT 'none',
`created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;