Files
tilbudgivern/create_imported_quotes_table.sql
T
alex fc40f65fec Add project data, quotes, and real project details for Kunda a/s
- Created test_project_data.json with project details including customer information, project description, and counts for geometry, labor, materials, and quotes.
- Added test_quote_data.json containing company information, project details, geometry, labor, materials, and calculation summary.
- Introduced test_real_project.json with comprehensive project data including labor, materials, and detailed calculations.
- Generated updated_real_project_quote.pdf reflecting the latest project quote details.
2025-09-17 15:13:52 +02:00

35 lines
1.3 KiB
SQL

-- Opret imported_quotes tabel til Ordrestyring import
CREATE TABLE IF NOT EXISTS imported_quotes (
id INT AUTO_INCREMENT PRIMARY KEY,
external_id VARCHAR(100) NOT NULL,
external_case_number VARCHAR(100) NOT NULL,
customer_name VARCHAR(255) NOT NULL,
customer_email VARCHAR(255),
customer_phone VARCHAR(50),
customer_address TEXT,
project_name VARCHAR(255) NOT NULL,
project_description TEXT,
total_amount_excl_vat DECIMAL(15,2) NOT NULL,
total_amount_incl_vat DECIMAL(15,2) NOT NULL,
currency VARCHAR(10) DEFAULT 'DKK',
status ENUM('Sendt tilbud', 'Under behandling', 'Accepteret', 'Afvist', 'Annulleret') NOT NULL,
case_type VARCHAR(100),
valid_until DATE,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
source VARCHAR(50) DEFAULT 'ordrestyring',
imported_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-- Indexes for performance
INDEX idx_external_id (external_id),
INDEX idx_case_number (external_case_number),
INDEX idx_customer_name (customer_name),
INDEX idx_status (status),
INDEX idx_case_type (case_type),
INDEX idx_created_at (created_at),
INDEX idx_total_amount (total_amount_incl_vat),
INDEX idx_imported_at (imported_at),
UNIQUE KEY unique_external_case (external_id, external_case_number)
);