-- Create TCOMP2701_INVOICE, the main table

CREATE TABLE TCOMP2701_INVOICE (
    invoice_id INT,
    customer_id INT,
    invoice_date DATE,
    due_date DATE,
    payment_date DATE,
    payment_status VARCHAR(20),
    payment_method VARCHAR(50),
    total_amount DECIMAL(18, 2),
    tax_amount DECIMAL(18, 2),
    discount_amount DECIMAL(18, 2),
    net_amount DECIMAL(18, 2),
    currency VARCHAR(10),
    billing_address_line1 VARCHAR(200),
    billing_address_line2 VARCHAR(200),
    billing_city VARCHAR(100),
    billing_state VARCHAR(50),
    billing_postal_code VARCHAR(20),
    billing_country VARCHAR(50),
    shipping_address_line1 VARCHAR(200),
    shipping_address_line2 VARCHAR(200),
    shipping_city VARCHAR(100),
    shipping_state VARCHAR(50),
    shipping_postal_code VARCHAR(20),
    shipping_country VARCHAR(50),
    item_description1 VARCHAR(200),
    item_quantity1 INT,
    item_price1 DECIMAL(18, 2),
    item_total1 DECIMAL(18, 2),
    item_description2 VARCHAR(200),
    item_quantity2 INT,
    item_price2 DECIMAL(18, 2),
    item_total2 DECIMAL(18, 2),
    item_description3 VARCHAR(200),
    item_quantity3 INT,
    item_price3 DECIMAL(18, 2),
    item_total3 DECIMAL(18, 2),
    item_description4 VARCHAR(200),
    item_quantity4 INT,
    item_price4 DECIMAL(18, 2),
    item_total4 DECIMAL(18, 2),
    item_description5 VARCHAR(200),
    item_quantity5 INT,
    item_price5 DECIMAL(18, 2),
    item_total5 DECIMAL(18, 2),
    created_timestamp TIMESTAMP,
    updated_timestamp TIMESTAMP,
    invoice_notes TEXT,
    terms_conditions TEXT,
    salesperson_id INT
);