164 lines
7.7 KiB
SQL
164 lines
7.7 KiB
SQL
-- P2P Demo Schema Data
|
|
CREATE SCHEMA IF NOT EXISTS p2p_demo;
|
|
|
|
CREATE TABLE p2p_demo.contract_line_items (
|
|
id integer NOT NULL,
|
|
contract_id text,
|
|
product_code text NOT NULL,
|
|
description text,
|
|
unit_price numeric(12,2) NOT NULL,
|
|
currency text DEFAULT 'INR'::text
|
|
);
|
|
|
|
ALTER TABLE p2p_demo.contract_line_items OWNER TO postgres;
|
|
CREATE SEQUENCE p2p_demo.contract_line_items_id_seq
|
|
ALTER SEQUENCE p2p_demo.contract_line_items_id_seq OWNER TO postgres;
|
|
ALTER SEQUENCE p2p_demo.contract_line_items_id_seq OWNED BY p2p_demo.contract_line_items.id;
|
|
CREATE TABLE p2p_demo.contracts (
|
|
contract_id text NOT NULL,
|
|
vendor_id text NOT NULL,
|
|
vendor_name text NOT NULL,
|
|
effective_date date,
|
|
expiry_date date,
|
|
status text DEFAULT 'active'::text,
|
|
payment_terms text,
|
|
price_tolerance_pct numeric(5,2) DEFAULT 2.0,
|
|
quantity_tolerance_pct numeric(5,2) DEFAULT 5.0,
|
|
created_at timestamp without time zone DEFAULT now()
|
|
);
|
|
|
|
ALTER TABLE p2p_demo.contracts OWNER TO postgres;
|
|
CREATE TABLE p2p_demo.goods_receipts (
|
|
gr_number text NOT NULL,
|
|
po_number text NOT NULL,
|
|
vendor_id text NOT NULL,
|
|
receipt_date date,
|
|
received_by text,
|
|
notes text,
|
|
created_at timestamp without time zone DEFAULT now()
|
|
);
|
|
|
|
ALTER TABLE p2p_demo.goods_receipts OWNER TO postgres;
|
|
CREATE TABLE p2p_demo.gr_line_items (
|
|
id integer NOT NULL,
|
|
gr_number text,
|
|
product_code text NOT NULL,
|
|
quantity_received integer NOT NULL,
|
|
condition text DEFAULT 'good'::text
|
|
);
|
|
|
|
ALTER TABLE p2p_demo.gr_line_items OWNER TO postgres;
|
|
CREATE SEQUENCE p2p_demo.gr_line_items_id_seq
|
|
ALTER SEQUENCE p2p_demo.gr_line_items_id_seq OWNER TO postgres;
|
|
ALTER SEQUENCE p2p_demo.gr_line_items_id_seq OWNED BY p2p_demo.gr_line_items.id;
|
|
CREATE TABLE p2p_demo.payments (
|
|
payment_id text NOT NULL,
|
|
invoice_number text,
|
|
po_number text,
|
|
vendor_id text NOT NULL,
|
|
amount numeric(14,2) NOT NULL,
|
|
payment_date date,
|
|
status text DEFAULT 'completed'::text,
|
|
created_at timestamp without time zone DEFAULT now()
|
|
);
|
|
|
|
ALTER TABLE p2p_demo.payments OWNER TO postgres;
|
|
CREATE TABLE p2p_demo.po_line_items (
|
|
id integer NOT NULL,
|
|
po_number text,
|
|
product_code text NOT NULL,
|
|
description text,
|
|
quantity integer NOT NULL,
|
|
unit_price numeric(12,2) NOT NULL
|
|
);
|
|
|
|
ALTER TABLE p2p_demo.po_line_items OWNER TO postgres;
|
|
CREATE SEQUENCE p2p_demo.po_line_items_id_seq
|
|
ALTER SEQUENCE p2p_demo.po_line_items_id_seq OWNER TO postgres;
|
|
ALTER SEQUENCE p2p_demo.po_line_items_id_seq OWNED BY p2p_demo.po_line_items.id;
|
|
CREATE TABLE p2p_demo.purchase_orders (
|
|
po_number text NOT NULL,
|
|
vendor_id text NOT NULL,
|
|
vendor_name text NOT NULL,
|
|
contract_id text,
|
|
order_date date,
|
|
expected_delivery date,
|
|
status text DEFAULT 'open'::text,
|
|
total_amount numeric(14,2),
|
|
created_at timestamp without time zone DEFAULT now()
|
|
);
|
|
|
|
ALTER TABLE p2p_demo.purchase_orders OWNER TO postgres;
|
|
ALTER TABLE ONLY p2p_demo.contract_line_items ALTER COLUMN id SET DEFAULT nextval('p2p_demo.contract_line_items_id_seq'::regclass);
|
|
ALTER TABLE ONLY p2p_demo.contract_line_items ALTER COLUMN id SET DEFAULT nextval('p2p_demo.contract_line_items_id_seq'::regclass);
|
|
ALTER TABLE ONLY p2p_demo.gr_line_items ALTER COLUMN id SET DEFAULT nextval('p2p_demo.gr_line_items_id_seq'::regclass);
|
|
ALTER TABLE ONLY p2p_demo.gr_line_items ALTER COLUMN id SET DEFAULT nextval('p2p_demo.gr_line_items_id_seq'::regclass);
|
|
ALTER TABLE ONLY p2p_demo.po_line_items ALTER COLUMN id SET DEFAULT nextval('p2p_demo.po_line_items_id_seq'::regclass);
|
|
ALTER TABLE ONLY p2p_demo.po_line_items ALTER COLUMN id SET DEFAULT nextval('p2p_demo.po_line_items_id_seq'::regclass);
|
|
COPY p2p_demo.contract_line_items (id, contract_id, product_code, description, unit_price, currency) FROM stdin;
|
|
233 CNT-100 PRD-101 Steel Rods 12mm 1000.00 INR
|
|
234 CNT-100 PRD-102 Steel Plates 5mm 2500.00 INR
|
|
235 CNT-200 PRD-201 A4 Paper Ream (500 sheets) 200.00 INR
|
|
236 CNT-200 PRD-202 Printer Ink Cartridge 1500.00 INR
|
|
237 CNT-300 PRD-301 Circuit Board Type-A 500.00 INR
|
|
238 CNT-300 PRD-302 LED Panel 24inch 3500.00 INR
|
|
239 CNT-400 PRD-401 Safety Helmet 150.00 INR
|
|
240 CNT-400 PRD-402 Industrial Gloves (pair) 80.00 INR
|
|
\.
|
|
|
|
COPY p2p_demo.contracts (contract_id, vendor_id, vendor_name, effective_date, expiry_date, status, payment_terms, price_tolerance_pct, quantity_tolerance_pct, created_at) FROM stdin;
|
|
CNT-100 VND-001 Tata Steel Ltd 2026-01-01 2026-12-31 active Net 30 2.00 5.00 2026-03-30 18:34:11.089882
|
|
CNT-200 VND-002 Reliance Office Supplies 2026-01-01 2026-12-31 active Net 15 3.00 5.00 2026-03-30 18:34:11.091337
|
|
CNT-300 VND-003 Bharat Electronics 2026-01-01 2026-12-31 active Net 30 2.00 5.00 2026-03-30 18:34:11.092484
|
|
CNT-400 VND-004 Godrej Industrial 2026-01-01 2026-12-31 active 2/10 Net 30 2.00 5.00 2026-03-30 18:34:11.093581
|
|
\.
|
|
|
|
COPY p2p_demo.goods_receipts (gr_number, po_number, vendor_id, receipt_date, received_by, notes, created_at) FROM stdin;
|
|
GR-2001 PO-2001 VND-002 2026-03-18 Amit Kumar Full delivery received. All items in good condition. 2026-03-30 18:34:11.100119
|
|
GR-1001 PO-1001 VND-001 2026-03-18 Rajesh Sharma Partial delivery. 700 of 1000 units received. Vendor confirmed remaining 300 shipped separately, expected April 5. 2026-03-30 18:34:11.101225
|
|
GR-3001 PO-3001 VND-003 2026-03-18 Sunil Verma Full delivery received. QC passed. 2026-03-30 18:34:11.102194
|
|
GR-2002 PO-2002 VND-002 2026-03-18 Amit Kumar Full delivery received. 2026-03-30 18:34:11.103112
|
|
GR-1002 PO-1002 VND-001 2026-03-18 Rajesh Sharma Partial delivery. 600 of 800 plates received. Remaining 200 delayed due to transport issues. 2026-03-30 18:34:11.104018
|
|
\.
|
|
|
|
COPY p2p_demo.gr_line_items (id, gr_number, product_code, quantity_received, condition) FROM stdin;
|
|
146 GR-2001 PRD-201 500 good
|
|
147 GR-1001 PRD-101 700 good
|
|
148 GR-3001 PRD-301 200 good
|
|
149 GR-2002 PRD-202 50 good
|
|
150 GR-1002 PRD-102 600 good
|
|
\.
|
|
|
|
COPY p2p_demo.payments (payment_id, invoice_number, po_number, vendor_id, amount, payment_date, status, created_at) FROM stdin;
|
|
PAY-5001 INV-2026-00700 PO-2002 VND-002 75000.00 2026-03-10 completed 2026-03-30 18:34:11.10478
|
|
PAY-5002 INV-2026-00800 PO-1002 VND-001 200000.00 2026-03-05 completed 2026-03-30 18:34:11.105142
|
|
\.
|
|
|
|
COPY p2p_demo.po_line_items (id, po_number, product_code, description, quantity, unit_price) FROM stdin;
|
|
175 PO-2001 PRD-201 A4 Paper Ream (500 sheets) 500 200.00
|
|
176 PO-1001 PRD-101 Steel Rods 12mm 1000 1000.00
|
|
177 PO-3001 PRD-301 Circuit Board Type-A 200 500.00
|
|
178 PO-2002 PRD-202 Printer Ink Cartridge 50 1500.00
|
|
179 PO-4001 PRD-401 Safety Helmet 300 150.00
|
|
180 PO-1002 PRD-102 Steel Plates 5mm 800 1000.00
|
|
\.
|
|
|
|
COPY p2p_demo.purchase_orders (po_number, vendor_id, vendor_name, contract_id, order_date, expected_delivery, status, total_amount, created_at) FROM stdin;
|
|
PO-2001 VND-002 Reliance Office Supplies CNT-200 2026-02-15 2026-03-15 fully_received 100000.00 2026-03-30 18:34:11.094652
|
|
PO-1001 VND-001 Tata Steel Ltd CNT-100 2026-02-15 2026-03-15 partially_received 1000000.00 2026-03-30 18:34:11.095959
|
|
PO-3001 VND-003 Bharat Electronics CNT-300 2026-02-15 2026-03-15 fully_received 100000.00 2026-03-30 18:34:11.096847
|
|
PO-2002 VND-002 Reliance Office Supplies CNT-200 2026-02-15 2026-03-15 fully_received 75000.00 2026-03-30 18:34:11.09772
|
|
PO-4001 VND-004 Godrej Industrial CNT-400 2026-02-15 2026-03-15 open 45000.00 2026-03-30 18:34:11.098572
|
|
PO-1002 VND-001 Tata Steel Ltd CNT-100 2026-02-15 2026-03-15 partially_received 800000.00 2026-03-30 18:34:11.099363
|
|
\.
|
|
|
|
ALTER TABLE ONLY p2p_demo.contract_line_items
|
|
ALTER TABLE ONLY p2p_demo.contracts
|
|
ALTER TABLE ONLY p2p_demo.goods_receipts
|
|
ALTER TABLE ONLY p2p_demo.gr_line_items
|
|
ALTER TABLE ONLY p2p_demo.payments
|
|
ALTER TABLE ONLY p2p_demo.po_line_items
|
|
ALTER TABLE ONLY p2p_demo.purchase_orders
|
|
ALTER TABLE ONLY p2p_demo.contract_line_items
|
|
ALTER TABLE ONLY p2p_demo.gr_line_items
|
|
ALTER TABLE ONLY p2p_demo.po_line_items |