Init commit

This commit is contained in:
2026-01-27 15:31:58 +03:00
commit e6dc59c266
37 changed files with 1707 additions and 0 deletions
@@ -0,0 +1 @@
DROP TABLE receipts;
+52
View File
@@ -0,0 +1,52 @@
CREATE TABLE receipts
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
-- основные поля
receipt_number TEXT NOT NULL UNIQUE,
ui TEXT NOT NULL,
status INTEGER NOT NULL,
issued_at TIMESTAMP NOT NULL,
-- суммы
total_amount REAL NOT NULL,
payment_amount REAL NOT NULL,
cash_amount REAL NOT NULL,
another_amount REAL NOT NULL,
clearing_amount REAL NOT NULL,
margin REAL NOT NULL,
currency TEXT NOT NULL,
payment_type INTEGER NOT NULL,
-- касса / продавец
cashbox_number INTEGER NOT NULL,
cashier TEXT,
-- организация / адрес
name_spd TEXT,
name_to TEXT,
name_np TEXT,
type_np TEXT,
street_to TEXT,
house_to TEXT,
-- SOATO (nullable)
kod_soato TEXT,
oblast_soato TEXT,
rayon_soato TEXT,
selsovet_soato TEXT,
-- прочее
doc_num TEXT,
skno_number TEXT,
unp TEXT,
success TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
@@ -0,0 +1 @@
DROP TABLE positions;
+25
View File
@@ -0,0 +1,25 @@
CREATE TABLE positions
(
id INTEGER PRIMARY KEY AUTOINCREMENT,
receipt_id INTEGER NOT NULL,
section_number TEXT,
gtin_code TEXT,
product_name TEXT NOT NULL,
product_count REAL NOT NULL,
amount REAL NOT NULL,
discount REAL,
surcharge REAL,
tag TEXT,
marking_code TEXT,
ukz_code TEXT,
FOREIGN KEY (receipt_id)
REFERENCES receipts (id)
ON DELETE CASCADE
);
+2
View File
@@ -0,0 +1,2 @@
DROP INDEX idx_positions_receipt_id;
DROP INDEX idx_receipts_issued_at;
+2
View File
@@ -0,0 +1,2 @@
CREATE INDEX idx_receipts_issued_at ON receipts(issued_at);
CREATE INDEX idx_positions_receipt_id ON positions(receipt_id);