CREATE TABLE cashbook (
    id integer NOT NULL PRIMARY KEY,
    date datetime,
    amount money,
    account nvarchar(50),
    item nvarchar(50),
    company nvarchar(50),
    comment nvarchar(255)
);

CREATE VIEW view_cashbook
AS
SELECT
    p.id
    , p.date
    , p.amount
    , p.account
    , p.item
    , p.company
    , p.comment
FROM
    cashbook p
;

INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-01-10', 200000, 'Bank', 'Customer C1', 'Revenue', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-01-10', -50000, 'Bank', 'Supplier S1', 'Expenses', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-01-31', -15000, 'Bank', 'Individual Income Tax', 'Taxes', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-01-31', -15000, 'Bank', 'Payroll Taxes', 'Taxes', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-01-31', -85000, 'Bank', NULL, 'Payroll', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-02-10', 300000, 'Bank', 'Customer C1', 'Revenue', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-02-10', 100000, 'Bank', 'Customer C2', 'Revenue', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-02-10', -50000, 'Bank', 'Supplier S2', 'Expenses', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-02-10',-100000, 'Bank', 'Supplier S1', 'Expenses', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-02-28', -15000, 'Bank', 'Individual Income Tax', 'Taxes', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-02-28', -15000, 'Bank', 'Payroll Taxes', 'Taxes', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-02-28', -85000, 'Bank', NULL, 'Payroll', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-10', 300000, 'Bank', 'Customer C1', 'Revenue', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-10', 200000, 'Bank', 'Customer C2', 'Revenue', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-10', 100000, 'Bank', 'Customer C3', 'Revenue', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-15',-100000, 'Bank', 'Corporate Income Tax', 'Taxes', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-31', -30000, 'Bank', 'Individual Income Tax', 'Taxes', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-31', -50000, 'Bank', 'Supplier S2', 'Expenses', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-31', -30000, 'Bank', 'Payroll Taxes', 'Taxes', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-31',-100000, 'Bank', 'Supplier S1', 'Expenses', NULL);
INSERT INTO cashbook (date, amount, account, company, item, comment) VALUES ('2023-03-31',-170000, 'Bank', NULL, 'Payroll', NULL);

-- print Application installed
