stockor 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +220 -0
- data/Guardfile +13 -0
- data/README.md +7 -0
- data/Rakefile +7 -0
- data/client/skr/Extension.coffee +12 -0
- data/client/skr/components/.gitkeep +0 -0
- data/client/skr/components/address/Address.coffee +21 -0
- data/client/skr/components/address/address.html +20 -0
- data/client/skr/index.js +21 -0
- data/client/skr/models/Address.coffee +17 -0
- data/client/skr/models/Base.coffee +8 -0
- data/client/skr/models/Customer.coffee +26 -0
- data/client/skr/models/GlAccount.coffee +10 -0
- data/client/skr/models/GlManualEntry.coffee +11 -0
- data/client/skr/models/GlPeriod.coffee +10 -0
- data/client/skr/models/GlPosting.coffee +15 -0
- data/client/skr/models/GlTransaction.coffee +16 -0
- data/client/skr/models/IaLine.coffee +19 -0
- data/client/skr/models/IaReason.coffee +12 -0
- data/client/skr/models/InvLine.coffee +27 -0
- data/client/skr/models/InventoryAdjustment.coffee +17 -0
- data/client/skr/models/Invoice.coffee +31 -0
- data/client/skr/models/Location.coffee +15 -0
- data/client/skr/models/PaymentTerm.coffee +11 -0
- data/client/skr/models/PickTicket.coffee +19 -0
- data/client/skr/models/PoLine.coffee +27 -0
- data/client/skr/models/PoReceipt.coffee +20 -0
- data/client/skr/models/PorLine.coffee +26 -0
- data/client/skr/models/PtLine.coffee +27 -0
- data/client/skr/models/PurchaseOrder.coffee +23 -0
- data/client/skr/models/SalesOrder.coffee +32 -0
- data/client/skr/models/Sku.coffee +21 -0
- data/client/skr/models/SkuLoc.coffee +21 -0
- data/client/skr/models/SkuTran.coffee +23 -0
- data/client/skr/models/SkuVendor.coffee +19 -0
- data/client/skr/models/SoLine.coffee +27 -0
- data/client/skr/models/Uom.coffee +17 -0
- data/client/skr/models/Vendor.coffee +28 -0
- data/client/skr/models/VoLine.coffee +23 -0
- data/client/skr/models/Voucher.coffee +22 -0
- data/client/skr/models/mixins/CodeField.coffee +5 -0
- data/client/skr/screens/.gitkeep +0 -0
- data/client/skr/screens/Base.coffee +3 -0
- data/client/skr/screens/base/index.js +5 -0
- data/client/skr/screens/base/index.scss +9 -0
- data/client/skr/screens/base/layout.html +3 -0
- data/client/skr/screens/customer-maint/CustomerMaint.coffee +49 -0
- data/client/skr/screens/customer-maint/index.js +5 -0
- data/client/skr/screens/customer-maint/index.scss +9 -0
- data/client/skr/screens/customer-maint/layout.html +32 -0
- data/client/skr/styles.scss +1 -0
- data/client/skr/views/.gitkeep +0 -0
- data/client/skr/views/Base.coffee +5 -0
- data/config/database.yml +9 -0
- data/config/lanes.rb +7 -0
- data/config/routes.rb +39 -0
- data/config/screens.rb +17 -0
- data/config.ru +5 -0
- data/db/.gitkeep +0 -0
- data/db/migrate/20120110142845_create_skr_sequential_ids.rb +35 -0
- data/db/migrate/20140202185309_create_skr_gl_accounts.rb +15 -0
- data/db/migrate/20140202193316_create_skr_gl_periods.rb +16 -0
- data/db/migrate/20140202193318_create_skr_gl_transactions.rb +14 -0
- data/db/migrate/20140202193319_create_skr_gl_postings.rb +16 -0
- data/db/migrate/20140202193700_create_skr_gl_manual_entries.rb +13 -0
- data/db/migrate/20140213040608_create_skr_payment_terms.rb +16 -0
- data/db/migrate/20140220031700_create_skr_addresses.rb +19 -0
- data/db/migrate/20140220031800_create_skr_locations.rb +19 -0
- data/db/migrate/20140220190836_create_skr_vendors.rb +22 -0
- data/db/migrate/20140220203029_create_skr_customers.rb +22 -0
- data/db/migrate/20140224034759_create_skr_skus.rb +22 -0
- data/db/migrate/20140225032853_create_skr_sku_locs.rb +21 -0
- data/db/migrate/20140320030501_create_skr_uoms.rb +19 -0
- data/db/migrate/20140321031604_create_skr_sku_vendors.rb +18 -0
- data/db/migrate/20140322012143_create_skr_ia_reasons.rb +14 -0
- data/db/migrate/20140322014401_create_skr_inventory_adjustments.rb +16 -0
- data/db/migrate/20140322023453_create_skr_ia_lines.rb +18 -0
- data/db/migrate/20140322035024_create_skr_sku_trans.rb +21 -0
- data/db/migrate/20140322223912_create_skr_sales_orders.rb +27 -0
- data/db/migrate/20140322223920_create_skr_so_lines.rb +25 -0
- data/db/migrate/20140323001446_create_so_details_view.rb +81 -0
- data/db/migrate/20140327202102_create_skr_purchase_orders.rb +20 -0
- data/db/migrate/20140327202107_create_skr_po_lines.rb +25 -0
- data/db/migrate/20140327202207_create_skr_pick_tickets.rb +16 -0
- data/db/migrate/20140327202209_create_skr_pt_lines.rb +23 -0
- data/db/migrate/20140327224000_create_skr_invoices.rb +25 -0
- data/db/migrate/20140327224002_create_skr_inv_lines.rb +23 -0
- data/db/migrate/20140330232808_create_skr_sku_loc_details_view.rb +31 -0
- data/db/migrate/20140330232810_create_skr_sku_qty_details_view.rb +48 -0
- data/db/migrate/20140400164729_create_skr_vouchers.rb +22 -0
- data/db/migrate/20140400164733_create_skr_vo_lines.rb +21 -0
- data/db/migrate/20140401164729_create_skr_po_receipt.rb +16 -0
- data/db/migrate/20140401164740_create_skr_por_line.rb +21 -0
- data/db/migrate/20140422024010_create_skr_inv_details_view.rb +42 -0
- data/db/schema.sql +2662 -0
- data/db/seed/chart_of_accounts.yml +168 -0
- data/db/seed/payment_terms.yml +60 -0
- data/db/seed.rb +29 -0
- data/lib/skr/access_roles.rb +28 -0
- data/lib/skr/concerns/acts_as_uom.rb +47 -0
- data/lib/skr/concerns/code_identifier.rb +43 -0
- data/lib/skr/concerns/gl_tran_extensions.rb +18 -0
- data/lib/skr/concerns/has_gl_transaction.rb +67 -0
- data/lib/skr/concerns/has_sku_loc_lines.rb +47 -0
- data/lib/skr/concerns/immutable_model.rb +32 -0
- data/lib/skr/concerns/inv_extensions.rb +24 -0
- data/lib/skr/concerns/is_order_like.rb +47 -0
- data/lib/skr/concerns/is_sku_loc_line.rb +65 -0
- data/lib/skr/concerns/locked_fields.rb +84 -0
- data/lib/skr/concerns/pt_extensions.rb +22 -0
- data/lib/skr/concerns/random_hash_code.rb +40 -0
- data/lib/skr/concerns/so_extensions.rb +30 -0
- data/lib/skr/concerns/state_machine.rb +61 -0
- data/lib/skr/concerns/visible_id_identifier.rb +53 -0
- data/lib/skr/configuration.rb +68 -0
- data/lib/skr/db/migration_helpers.rb +178 -0
- data/lib/skr/extension.rb +23 -0
- data/lib/skr/model.rb +19 -0
- data/lib/skr/models/address.rb +97 -0
- data/lib/skr/models/business_entity.rb +29 -0
- data/lib/skr/models/customer.rb +35 -0
- data/lib/skr/models/gl_account.rb +56 -0
- data/lib/skr/models/gl_manual_entry.rb +31 -0
- data/lib/skr/models/gl_period.rb +13 -0
- data/lib/skr/models/gl_posting.rb +54 -0
- data/lib/skr/models/gl_transaction.rb +175 -0
- data/lib/skr/models/ia_line.rb +129 -0
- data/lib/skr/models/ia_reason.rb +16 -0
- data/lib/skr/models/inv_line.rb +90 -0
- data/lib/skr/models/inventory_adjustment.rb +60 -0
- data/lib/skr/models/invoice.rb +159 -0
- data/lib/skr/models/location.rb +31 -0
- data/lib/skr/models/payment_term.rb +30 -0
- data/lib/skr/models/pick_ticket.rb +71 -0
- data/lib/skr/models/po_line.rb +69 -0
- data/lib/skr/models/po_receipt.rb +51 -0
- data/lib/skr/models/por_line.rb +80 -0
- data/lib/skr/models/pt_line.rb +74 -0
- data/lib/skr/models/purchase_order.rb +112 -0
- data/lib/skr/models/sales_order.rb +159 -0
- data/lib/skr/models/sequential_id.rb +23 -0
- data/lib/skr/models/sku.rb +99 -0
- data/lib/skr/models/sku_loc.rb +94 -0
- data/lib/skr/models/sku_tran.rb +111 -0
- data/lib/skr/models/sku_vendor.rb +26 -0
- data/lib/skr/models/so_line.rb +159 -0
- data/lib/skr/models/uom.rb +63 -0
- data/lib/skr/models/user_proxy.rb +60 -0
- data/lib/skr/models/vendor.rb +33 -0
- data/lib/skr/models/vo_line.rb +35 -0
- data/lib/skr/models/voucher.rb +119 -0
- data/lib/skr/standard_pricing_provider.rb +14 -0
- data/lib/skr/version.rb +3 -0
- data/lib/skr.rb +18 -0
- data/lib/stockor.rb +4 -0
- data/lib/tasks/debug-activity.rake +58 -0
- data/log/test.log +0 -0
- data/spec/fixtures/skr/address.yml +2 -0
- data/spec/fixtures/skr/customer.yml +2 -0
- data/spec/fixtures/skr/gl_account.yml +2 -0
- data/spec/fixtures/skr/gl_manual_entry.yml +2 -0
- data/spec/fixtures/skr/gl_period.yml +2 -0
- data/spec/fixtures/skr/gl_posting.yml +2 -0
- data/spec/fixtures/skr/gl_transaction.yml +2 -0
- data/spec/fixtures/skr/ia_line.yml +2 -0
- data/spec/fixtures/skr/ia_reason.yml +2 -0
- data/spec/fixtures/skr/inv_line.yml +2 -0
- data/spec/fixtures/skr/inventory_adjustment.yml +2 -0
- data/spec/fixtures/skr/invoice.yml +2 -0
- data/spec/fixtures/skr/location.yml +2 -0
- data/spec/fixtures/skr/payment_term.yml +2 -0
- data/spec/fixtures/skr/pick_ticket.yml +2 -0
- data/spec/fixtures/skr/po_line.yml +2 -0
- data/spec/fixtures/skr/po_receipt.yml +2 -0
- data/spec/fixtures/skr/por_line.yml +2 -0
- data/spec/fixtures/skr/pt_line.yml +2 -0
- data/spec/fixtures/skr/purchase_order.yml +2 -0
- data/spec/fixtures/skr/sales_order.yml +2 -0
- data/spec/fixtures/skr/sku.yml +2 -0
- data/spec/fixtures/skr/sku_loc.yml +2 -0
- data/spec/fixtures/skr/sku_tran.yml +2 -0
- data/spec/fixtures/skr/sku_vendor.yml +2 -0
- data/spec/fixtures/skr/so_line.yml +2 -0
- data/spec/fixtures/skr/uom.yml +2 -0
- data/spec/fixtures/skr/vendor.yml +2 -0
- data/spec/fixtures/skr/vo_line.yml +2 -0
- data/spec/fixtures/skr/voucher.yml +2 -0
- data/spec/skr/address.rb +10 -0
- data/spec/skr/concerns/code_identifier_spec.rb +45 -0
- data/spec/skr/customer.rb +10 -0
- data/spec/skr/gl_account.rb +10 -0
- data/spec/skr/gl_manual_entry.rb +10 -0
- data/spec/skr/gl_period.rb +10 -0
- data/spec/skr/gl_posting.rb +10 -0
- data/spec/skr/gl_transaction.rb +10 -0
- data/spec/skr/ia_line.rb +10 -0
- data/spec/skr/ia_reason.rb +10 -0
- data/spec/skr/inv_line.rb +10 -0
- data/spec/skr/inventory_adjustment.rb +10 -0
- data/spec/skr/invoice.rb +10 -0
- data/spec/skr/location.rb +10 -0
- data/spec/skr/models/AddressSpec.coffee +5 -0
- data/spec/skr/models/CustomerSpec.coffee +5 -0
- data/spec/skr/models/GlAccountSpec.coffee +5 -0
- data/spec/skr/models/GlManualEntrySpec.coffee +5 -0
- data/spec/skr/models/GlPeriodSpec.coffee +5 -0
- data/spec/skr/models/GlPostingSpec.coffee +5 -0
- data/spec/skr/models/GlTransactionSpec.coffee +5 -0
- data/spec/skr/models/IaLineSpec.coffee +5 -0
- data/spec/skr/models/IaReasonSpec.coffee +5 -0
- data/spec/skr/models/InvLineSpec.coffee +5 -0
- data/spec/skr/models/InventoryAdjustmentSpec.coffee +5 -0
- data/spec/skr/models/InvoiceSpec.coffee +5 -0
- data/spec/skr/models/LocationSpec.coffee +5 -0
- data/spec/skr/models/PaymentTermSpec.coffee +5 -0
- data/spec/skr/models/PickTicketSpec.coffee +5 -0
- data/spec/skr/models/PoLineSpec.coffee +5 -0
- data/spec/skr/models/PoReceiptSpec.coffee +5 -0
- data/spec/skr/models/PorLineSpec.coffee +5 -0
- data/spec/skr/models/PtLineSpec.coffee +5 -0
- data/spec/skr/models/PurchaseOrderSpec.coffee +5 -0
- data/spec/skr/models/SalesOrderSpec.coffee +5 -0
- data/spec/skr/models/SkuLocSpec.coffee +5 -0
- data/spec/skr/models/SkuSpec.coffee +5 -0
- data/spec/skr/models/SkuTranSpec.coffee +5 -0
- data/spec/skr/models/SkuVendorSpec.coffee +5 -0
- data/spec/skr/models/SoLineSpec.coffee +5 -0
- data/spec/skr/models/UomSpec.coffee +5 -0
- data/spec/skr/models/VendorSpec.coffee +5 -0
- data/spec/skr/models/VoLineSpec.coffee +5 -0
- data/spec/skr/models/VoucherSpec.coffee +5 -0
- data/spec/skr/payment_term.rb +10 -0
- data/spec/skr/pick_ticket.rb +10 -0
- data/spec/skr/po_line.rb +10 -0
- data/spec/skr/po_receipt.rb +10 -0
- data/spec/skr/por_line.rb +10 -0
- data/spec/skr/pt_line.rb +10 -0
- data/spec/skr/purchase_order.rb +10 -0
- data/spec/skr/sales_order.rb +10 -0
- data/spec/skr/screens/Base.coffee +7 -0
- data/spec/skr/screens/CustomerMaint.coffee +7 -0
- data/spec/skr/screens/vendor-maint/VendorMaintSpec.coffee +5 -0
- data/spec/skr/sku.rb +10 -0
- data/spec/skr/sku_loc.rb +10 -0
- data/spec/skr/sku_tran.rb +10 -0
- data/spec/skr/sku_vendor.rb +10 -0
- data/spec/skr/so_line.rb +10 -0
- data/spec/skr/spec_helper.rb +26 -0
- data/spec/skr/uom.rb +10 -0
- data/spec/skr/vendor.rb +10 -0
- data/spec/skr/views/AddressSpec.coffee +5 -0
- data/spec/skr/vo_line.rb +10 -0
- data/spec/skr/voucher.rb +10 -0
- data/stockor.gemspec +38 -0
- data/tmp/.gitkeep +0 -0
- metadata +414 -0
data/db/schema.sql
ADDED
@@ -0,0 +1,2662 @@
|
|
1
|
+
--
|
2
|
+
-- PostgreSQL database dump
|
3
|
+
--
|
4
|
+
|
5
|
+
SET statement_timeout = 0;
|
6
|
+
SET lock_timeout = 0;
|
7
|
+
SET client_encoding = 'UTF8';
|
8
|
+
SET standard_conforming_strings = on;
|
9
|
+
SET check_function_bodies = false;
|
10
|
+
SET client_min_messages = warning;
|
11
|
+
|
12
|
+
--
|
13
|
+
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
|
14
|
+
--
|
15
|
+
|
16
|
+
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
17
|
+
|
18
|
+
|
19
|
+
--
|
20
|
+
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
|
21
|
+
--
|
22
|
+
|
23
|
+
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
24
|
+
|
25
|
+
|
26
|
+
--
|
27
|
+
-- Name: hstore; Type: EXTENSION; Schema: -; Owner: -
|
28
|
+
--
|
29
|
+
|
30
|
+
CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;
|
31
|
+
|
32
|
+
|
33
|
+
--
|
34
|
+
-- Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner: -
|
35
|
+
--
|
36
|
+
|
37
|
+
COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';
|
38
|
+
|
39
|
+
|
40
|
+
SET search_path = public, pg_catalog;
|
41
|
+
|
42
|
+
--
|
43
|
+
-- Name: skr_next_sequential_id(character varying); Type: FUNCTION; Schema: public; Owner: -
|
44
|
+
--
|
45
|
+
|
46
|
+
CREATE FUNCTION skr_next_sequential_id(character varying) RETURNS integer
|
47
|
+
LANGUAGE plpgsql
|
48
|
+
AS $_$
|
49
|
+
declare
|
50
|
+
next_id integer;
|
51
|
+
begin
|
52
|
+
select current_value into next_id from skr_sequential_ids where name = $1 for update;
|
53
|
+
if not found then
|
54
|
+
insert into skr_sequential_ids ( name, current_value ) values ( $1, 1 );
|
55
|
+
return 1;
|
56
|
+
else
|
57
|
+
update skr_sequential_ids set current_value = next_id+1 where name = $1;
|
58
|
+
return next_id+1;
|
59
|
+
end if;
|
60
|
+
end;
|
61
|
+
$_$;
|
62
|
+
|
63
|
+
|
64
|
+
SET default_tablespace = '';
|
65
|
+
|
66
|
+
SET default_with_oids = false;
|
67
|
+
|
68
|
+
--
|
69
|
+
-- Name: lanes_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
70
|
+
--
|
71
|
+
|
72
|
+
CREATE TABLE lanes_users (
|
73
|
+
id integer NOT NULL,
|
74
|
+
login character varying NOT NULL,
|
75
|
+
name character varying NOT NULL,
|
76
|
+
email character varying NOT NULL,
|
77
|
+
password_digest character varying NOT NULL,
|
78
|
+
role_names character varying[] DEFAULT '{}'::character varying[] NOT NULL,
|
79
|
+
options hstore DEFAULT ''::hstore NOT NULL,
|
80
|
+
created_at timestamp without time zone NOT NULL,
|
81
|
+
updated_at timestamp without time zone NOT NULL
|
82
|
+
);
|
83
|
+
|
84
|
+
|
85
|
+
--
|
86
|
+
-- Name: lanes_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
87
|
+
--
|
88
|
+
|
89
|
+
CREATE SEQUENCE lanes_users_id_seq
|
90
|
+
START WITH 1
|
91
|
+
INCREMENT BY 1
|
92
|
+
NO MINVALUE
|
93
|
+
NO MAXVALUE
|
94
|
+
CACHE 1;
|
95
|
+
|
96
|
+
|
97
|
+
--
|
98
|
+
-- Name: lanes_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
99
|
+
--
|
100
|
+
|
101
|
+
ALTER SEQUENCE lanes_users_id_seq OWNED BY lanes_users.id;
|
102
|
+
|
103
|
+
|
104
|
+
--
|
105
|
+
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
106
|
+
--
|
107
|
+
|
108
|
+
CREATE TABLE schema_migrations (
|
109
|
+
version character varying NOT NULL
|
110
|
+
);
|
111
|
+
|
112
|
+
|
113
|
+
--
|
114
|
+
-- Name: skr_addresses; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
115
|
+
--
|
116
|
+
|
117
|
+
CREATE TABLE skr_addresses (
|
118
|
+
id integer NOT NULL,
|
119
|
+
name character varying,
|
120
|
+
email character varying,
|
121
|
+
phone character varying,
|
122
|
+
line1 character varying,
|
123
|
+
line2 character varying,
|
124
|
+
city character varying,
|
125
|
+
state character varying,
|
126
|
+
postal_code character varying,
|
127
|
+
created_at timestamp without time zone NOT NULL,
|
128
|
+
created_by_id integer NOT NULL,
|
129
|
+
updated_at timestamp without time zone NOT NULL,
|
130
|
+
updated_by_id integer NOT NULL
|
131
|
+
);
|
132
|
+
|
133
|
+
|
134
|
+
--
|
135
|
+
-- Name: skr_addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
136
|
+
--
|
137
|
+
|
138
|
+
CREATE SEQUENCE skr_addresses_id_seq
|
139
|
+
START WITH 1
|
140
|
+
INCREMENT BY 1
|
141
|
+
NO MINVALUE
|
142
|
+
NO MAXVALUE
|
143
|
+
CACHE 1;
|
144
|
+
|
145
|
+
|
146
|
+
--
|
147
|
+
-- Name: skr_addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
148
|
+
--
|
149
|
+
|
150
|
+
ALTER SEQUENCE skr_addresses_id_seq OWNED BY skr_addresses.id;
|
151
|
+
|
152
|
+
|
153
|
+
--
|
154
|
+
-- Name: skr_customers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
155
|
+
--
|
156
|
+
|
157
|
+
CREATE TABLE skr_customers (
|
158
|
+
id integer NOT NULL,
|
159
|
+
code character varying NOT NULL,
|
160
|
+
billing_address_id integer NOT NULL,
|
161
|
+
shipping_address_id integer NOT NULL,
|
162
|
+
terms_id integer NOT NULL,
|
163
|
+
gl_receivables_account_id integer NOT NULL,
|
164
|
+
credit_limit numeric(15,2) DEFAULT 0.0,
|
165
|
+
open_balance numeric(15,2) DEFAULT 0.0,
|
166
|
+
hash_code character varying NOT NULL,
|
167
|
+
name character varying NOT NULL,
|
168
|
+
notes text,
|
169
|
+
website text,
|
170
|
+
options hstore DEFAULT ''::hstore,
|
171
|
+
created_at timestamp without time zone NOT NULL,
|
172
|
+
created_by_id integer NOT NULL,
|
173
|
+
updated_at timestamp without time zone NOT NULL,
|
174
|
+
updated_by_id integer NOT NULL
|
175
|
+
);
|
176
|
+
|
177
|
+
|
178
|
+
--
|
179
|
+
-- Name: skr_customers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
180
|
+
--
|
181
|
+
|
182
|
+
CREATE SEQUENCE skr_customers_id_seq
|
183
|
+
START WITH 1
|
184
|
+
INCREMENT BY 1
|
185
|
+
NO MINVALUE
|
186
|
+
NO MAXVALUE
|
187
|
+
CACHE 1;
|
188
|
+
|
189
|
+
|
190
|
+
--
|
191
|
+
-- Name: skr_customers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
192
|
+
--
|
193
|
+
|
194
|
+
ALTER SEQUENCE skr_customers_id_seq OWNED BY skr_customers.id;
|
195
|
+
|
196
|
+
|
197
|
+
--
|
198
|
+
-- Name: skr_gl_accounts; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
199
|
+
--
|
200
|
+
|
201
|
+
CREATE TABLE skr_gl_accounts (
|
202
|
+
id integer NOT NULL,
|
203
|
+
number character varying NOT NULL,
|
204
|
+
name character varying NOT NULL,
|
205
|
+
description text NOT NULL,
|
206
|
+
is_active boolean DEFAULT true NOT NULL,
|
207
|
+
created_at timestamp without time zone NOT NULL,
|
208
|
+
created_by_id integer NOT NULL,
|
209
|
+
updated_at timestamp without time zone NOT NULL,
|
210
|
+
updated_by_id integer NOT NULL
|
211
|
+
);
|
212
|
+
|
213
|
+
|
214
|
+
--
|
215
|
+
-- Name: skr_gl_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
216
|
+
--
|
217
|
+
|
218
|
+
CREATE SEQUENCE skr_gl_accounts_id_seq
|
219
|
+
START WITH 1
|
220
|
+
INCREMENT BY 1
|
221
|
+
NO MINVALUE
|
222
|
+
NO MAXVALUE
|
223
|
+
CACHE 1;
|
224
|
+
|
225
|
+
|
226
|
+
--
|
227
|
+
-- Name: skr_gl_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
228
|
+
--
|
229
|
+
|
230
|
+
ALTER SEQUENCE skr_gl_accounts_id_seq OWNED BY skr_gl_accounts.id;
|
231
|
+
|
232
|
+
|
233
|
+
--
|
234
|
+
-- Name: skr_gl_manual_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
235
|
+
--
|
236
|
+
|
237
|
+
CREATE TABLE skr_gl_manual_entries (
|
238
|
+
id integer NOT NULL,
|
239
|
+
visible_id integer NOT NULL,
|
240
|
+
notes text,
|
241
|
+
created_at timestamp without time zone NOT NULL,
|
242
|
+
created_by_id integer NOT NULL,
|
243
|
+
updated_at timestamp without time zone NOT NULL,
|
244
|
+
updated_by_id integer NOT NULL
|
245
|
+
);
|
246
|
+
|
247
|
+
|
248
|
+
--
|
249
|
+
-- Name: skr_gl_manual_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
250
|
+
--
|
251
|
+
|
252
|
+
CREATE SEQUENCE skr_gl_manual_entries_id_seq
|
253
|
+
START WITH 1
|
254
|
+
INCREMENT BY 1
|
255
|
+
NO MINVALUE
|
256
|
+
NO MAXVALUE
|
257
|
+
CACHE 1;
|
258
|
+
|
259
|
+
|
260
|
+
--
|
261
|
+
-- Name: skr_gl_manual_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
262
|
+
--
|
263
|
+
|
264
|
+
ALTER SEQUENCE skr_gl_manual_entries_id_seq OWNED BY skr_gl_manual_entries.id;
|
265
|
+
|
266
|
+
|
267
|
+
--
|
268
|
+
-- Name: skr_gl_periods; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
269
|
+
--
|
270
|
+
|
271
|
+
CREATE TABLE skr_gl_periods (
|
272
|
+
id integer NOT NULL,
|
273
|
+
year smallint NOT NULL,
|
274
|
+
period smallint NOT NULL,
|
275
|
+
is_locked boolean DEFAULT false NOT NULL,
|
276
|
+
created_at timestamp without time zone NOT NULL,
|
277
|
+
created_by_id integer NOT NULL,
|
278
|
+
updated_at timestamp without time zone NOT NULL,
|
279
|
+
updated_by_id integer NOT NULL
|
280
|
+
);
|
281
|
+
|
282
|
+
|
283
|
+
--
|
284
|
+
-- Name: skr_gl_periods_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
285
|
+
--
|
286
|
+
|
287
|
+
CREATE SEQUENCE skr_gl_periods_id_seq
|
288
|
+
START WITH 1
|
289
|
+
INCREMENT BY 1
|
290
|
+
NO MINVALUE
|
291
|
+
NO MAXVALUE
|
292
|
+
CACHE 1;
|
293
|
+
|
294
|
+
|
295
|
+
--
|
296
|
+
-- Name: skr_gl_periods_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
297
|
+
--
|
298
|
+
|
299
|
+
ALTER SEQUENCE skr_gl_periods_id_seq OWNED BY skr_gl_periods.id;
|
300
|
+
|
301
|
+
|
302
|
+
--
|
303
|
+
-- Name: skr_gl_postings; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
304
|
+
--
|
305
|
+
|
306
|
+
CREATE TABLE skr_gl_postings (
|
307
|
+
id integer NOT NULL,
|
308
|
+
gl_transaction_id integer NOT NULL,
|
309
|
+
account_number character varying NOT NULL,
|
310
|
+
amount numeric(15,2) NOT NULL,
|
311
|
+
is_debit boolean NOT NULL,
|
312
|
+
year smallint NOT NULL,
|
313
|
+
period smallint NOT NULL,
|
314
|
+
created_at timestamp without time zone NOT NULL,
|
315
|
+
created_by_id integer NOT NULL
|
316
|
+
);
|
317
|
+
|
318
|
+
|
319
|
+
--
|
320
|
+
-- Name: skr_gl_postings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
321
|
+
--
|
322
|
+
|
323
|
+
CREATE SEQUENCE skr_gl_postings_id_seq
|
324
|
+
START WITH 1
|
325
|
+
INCREMENT BY 1
|
326
|
+
NO MINVALUE
|
327
|
+
NO MAXVALUE
|
328
|
+
CACHE 1;
|
329
|
+
|
330
|
+
|
331
|
+
--
|
332
|
+
-- Name: skr_gl_postings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
333
|
+
--
|
334
|
+
|
335
|
+
ALTER SEQUENCE skr_gl_postings_id_seq OWNED BY skr_gl_postings.id;
|
336
|
+
|
337
|
+
|
338
|
+
--
|
339
|
+
-- Name: skr_gl_transactions; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
340
|
+
--
|
341
|
+
|
342
|
+
CREATE TABLE skr_gl_transactions (
|
343
|
+
id integer NOT NULL,
|
344
|
+
period_id integer NOT NULL,
|
345
|
+
source_id integer,
|
346
|
+
source_type character varying,
|
347
|
+
description text NOT NULL,
|
348
|
+
created_at timestamp without time zone NOT NULL,
|
349
|
+
created_by_id integer NOT NULL
|
350
|
+
);
|
351
|
+
|
352
|
+
|
353
|
+
--
|
354
|
+
-- Name: skr_gl_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
355
|
+
--
|
356
|
+
|
357
|
+
CREATE SEQUENCE skr_gl_transactions_id_seq
|
358
|
+
START WITH 1
|
359
|
+
INCREMENT BY 1
|
360
|
+
NO MINVALUE
|
361
|
+
NO MAXVALUE
|
362
|
+
CACHE 1;
|
363
|
+
|
364
|
+
|
365
|
+
--
|
366
|
+
-- Name: skr_gl_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
367
|
+
--
|
368
|
+
|
369
|
+
ALTER SEQUENCE skr_gl_transactions_id_seq OWNED BY skr_gl_transactions.id;
|
370
|
+
|
371
|
+
|
372
|
+
--
|
373
|
+
-- Name: skr_ia_lines; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
374
|
+
--
|
375
|
+
|
376
|
+
CREATE TABLE skr_ia_lines (
|
377
|
+
id integer NOT NULL,
|
378
|
+
inventory_adjustment_id integer NOT NULL,
|
379
|
+
sku_loc_id integer NOT NULL,
|
380
|
+
qty integer DEFAULT 1 NOT NULL,
|
381
|
+
uom_code character varying DEFAULT 'EA'::character varying NOT NULL,
|
382
|
+
uom_size smallint DEFAULT 1 NOT NULL,
|
383
|
+
cost numeric(15,2),
|
384
|
+
cost_was_set boolean DEFAULT false NOT NULL,
|
385
|
+
created_at timestamp without time zone NOT NULL,
|
386
|
+
created_by_id integer NOT NULL,
|
387
|
+
updated_at timestamp without time zone NOT NULL,
|
388
|
+
updated_by_id integer NOT NULL
|
389
|
+
);
|
390
|
+
|
391
|
+
|
392
|
+
--
|
393
|
+
-- Name: skr_ia_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
394
|
+
--
|
395
|
+
|
396
|
+
CREATE SEQUENCE skr_ia_lines_id_seq
|
397
|
+
START WITH 1
|
398
|
+
INCREMENT BY 1
|
399
|
+
NO MINVALUE
|
400
|
+
NO MAXVALUE
|
401
|
+
CACHE 1;
|
402
|
+
|
403
|
+
|
404
|
+
--
|
405
|
+
-- Name: skr_ia_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
406
|
+
--
|
407
|
+
|
408
|
+
ALTER SEQUENCE skr_ia_lines_id_seq OWNED BY skr_ia_lines.id;
|
409
|
+
|
410
|
+
|
411
|
+
--
|
412
|
+
-- Name: skr_ia_reasons; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
413
|
+
--
|
414
|
+
|
415
|
+
CREATE TABLE skr_ia_reasons (
|
416
|
+
id integer NOT NULL,
|
417
|
+
gl_account_id integer NOT NULL,
|
418
|
+
code character varying NOT NULL,
|
419
|
+
description character varying NOT NULL,
|
420
|
+
created_at timestamp without time zone NOT NULL,
|
421
|
+
created_by_id integer NOT NULL,
|
422
|
+
updated_at timestamp without time zone NOT NULL,
|
423
|
+
updated_by_id integer NOT NULL
|
424
|
+
);
|
425
|
+
|
426
|
+
|
427
|
+
--
|
428
|
+
-- Name: skr_ia_reasons_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
429
|
+
--
|
430
|
+
|
431
|
+
CREATE SEQUENCE skr_ia_reasons_id_seq
|
432
|
+
START WITH 1
|
433
|
+
INCREMENT BY 1
|
434
|
+
NO MINVALUE
|
435
|
+
NO MAXVALUE
|
436
|
+
CACHE 1;
|
437
|
+
|
438
|
+
|
439
|
+
--
|
440
|
+
-- Name: skr_ia_reasons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
441
|
+
--
|
442
|
+
|
443
|
+
ALTER SEQUENCE skr_ia_reasons_id_seq OWNED BY skr_ia_reasons.id;
|
444
|
+
|
445
|
+
|
446
|
+
--
|
447
|
+
-- Name: skr_inv_lines; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
448
|
+
--
|
449
|
+
|
450
|
+
CREATE TABLE skr_inv_lines (
|
451
|
+
id integer NOT NULL,
|
452
|
+
invoice_id integer NOT NULL,
|
453
|
+
sku_loc_id integer NOT NULL,
|
454
|
+
pt_line_id integer,
|
455
|
+
so_line_id integer,
|
456
|
+
price numeric(15,2) NOT NULL,
|
457
|
+
sku_code character varying NOT NULL,
|
458
|
+
description character varying NOT NULL,
|
459
|
+
uom_code character varying NOT NULL,
|
460
|
+
uom_size smallint NOT NULL,
|
461
|
+
"position" smallint NOT NULL,
|
462
|
+
qty integer NOT NULL,
|
463
|
+
is_revised boolean DEFAULT false NOT NULL,
|
464
|
+
created_at timestamp without time zone NOT NULL,
|
465
|
+
created_by_id integer NOT NULL,
|
466
|
+
updated_at timestamp without time zone NOT NULL,
|
467
|
+
updated_by_id integer NOT NULL
|
468
|
+
);
|
469
|
+
|
470
|
+
|
471
|
+
--
|
472
|
+
-- Name: skr_invoices; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
473
|
+
--
|
474
|
+
|
475
|
+
CREATE TABLE skr_invoices (
|
476
|
+
id integer NOT NULL,
|
477
|
+
visible_id integer NOT NULL,
|
478
|
+
terms_id integer NOT NULL,
|
479
|
+
customer_id integer NOT NULL,
|
480
|
+
location_id integer NOT NULL,
|
481
|
+
sales_order_id integer,
|
482
|
+
pick_ticket_id integer,
|
483
|
+
shipping_address_id integer NOT NULL,
|
484
|
+
billing_address_id integer NOT NULL,
|
485
|
+
amount_paid numeric(15,2) DEFAULT 0.0 NOT NULL,
|
486
|
+
state character varying NOT NULL,
|
487
|
+
hash_code character varying NOT NULL,
|
488
|
+
invoice_date date NOT NULL,
|
489
|
+
po_num character varying,
|
490
|
+
options hstore DEFAULT ''::hstore,
|
491
|
+
created_at timestamp without time zone NOT NULL,
|
492
|
+
created_by_id integer NOT NULL,
|
493
|
+
updated_at timestamp without time zone NOT NULL,
|
494
|
+
updated_by_id integer NOT NULL
|
495
|
+
);
|
496
|
+
|
497
|
+
|
498
|
+
--
|
499
|
+
-- Name: skr_pick_tickets; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
500
|
+
--
|
501
|
+
|
502
|
+
CREATE TABLE skr_pick_tickets (
|
503
|
+
id integer NOT NULL,
|
504
|
+
visible_id integer NOT NULL,
|
505
|
+
sales_order_id integer NOT NULL,
|
506
|
+
location_id integer NOT NULL,
|
507
|
+
shipped_at date,
|
508
|
+
is_complete boolean DEFAULT false,
|
509
|
+
created_at timestamp without time zone NOT NULL,
|
510
|
+
created_by_id integer NOT NULL,
|
511
|
+
updated_at timestamp without time zone NOT NULL,
|
512
|
+
updated_by_id integer NOT NULL
|
513
|
+
);
|
514
|
+
|
515
|
+
|
516
|
+
--
|
517
|
+
-- Name: skr_sales_orders; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
518
|
+
--
|
519
|
+
|
520
|
+
CREATE TABLE skr_sales_orders (
|
521
|
+
id integer NOT NULL,
|
522
|
+
visible_id integer NOT NULL,
|
523
|
+
customer_id integer NOT NULL,
|
524
|
+
location_id integer NOT NULL,
|
525
|
+
shipping_address_id integer NOT NULL,
|
526
|
+
billing_address_id integer NOT NULL,
|
527
|
+
terms_id integer NOT NULL,
|
528
|
+
order_date date NOT NULL,
|
529
|
+
state character varying NOT NULL,
|
530
|
+
is_revised boolean DEFAULT false NOT NULL,
|
531
|
+
hash_code character varying NOT NULL,
|
532
|
+
ship_partial boolean DEFAULT false NOT NULL,
|
533
|
+
is_complete boolean DEFAULT false NOT NULL,
|
534
|
+
po_num character varying,
|
535
|
+
notes text,
|
536
|
+
options hstore DEFAULT ''::hstore,
|
537
|
+
created_at timestamp without time zone NOT NULL,
|
538
|
+
created_by_id integer NOT NULL,
|
539
|
+
updated_at timestamp without time zone NOT NULL,
|
540
|
+
updated_by_id integer NOT NULL
|
541
|
+
);
|
542
|
+
|
543
|
+
|
544
|
+
--
|
545
|
+
-- Name: skr_sku_locs; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
546
|
+
--
|
547
|
+
|
548
|
+
CREATE TABLE skr_sku_locs (
|
549
|
+
id integer NOT NULL,
|
550
|
+
sku_id integer NOT NULL,
|
551
|
+
location_id integer NOT NULL,
|
552
|
+
mac numeric(15,4) DEFAULT 0.0 NOT NULL,
|
553
|
+
qty integer DEFAULT 0 NOT NULL,
|
554
|
+
qty_allocated integer DEFAULT 0 NOT NULL,
|
555
|
+
qty_picking integer DEFAULT 0 NOT NULL,
|
556
|
+
qty_reserved integer DEFAULT 0 NOT NULL,
|
557
|
+
bin character varying,
|
558
|
+
created_at timestamp without time zone NOT NULL,
|
559
|
+
created_by_id integer NOT NULL,
|
560
|
+
updated_at timestamp without time zone NOT NULL,
|
561
|
+
updated_by_id integer NOT NULL
|
562
|
+
);
|
563
|
+
|
564
|
+
|
565
|
+
--
|
566
|
+
-- Name: skr_skus; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
567
|
+
--
|
568
|
+
|
569
|
+
CREATE TABLE skr_skus (
|
570
|
+
id integer NOT NULL,
|
571
|
+
default_vendor_id integer NOT NULL,
|
572
|
+
gl_asset_account_id integer NOT NULL,
|
573
|
+
default_uom_code character varying NOT NULL,
|
574
|
+
code character varying NOT NULL,
|
575
|
+
description character varying NOT NULL,
|
576
|
+
is_other_charge boolean DEFAULT false NOT NULL,
|
577
|
+
does_track_inventory boolean DEFAULT false NOT NULL,
|
578
|
+
can_backorder boolean DEFAULT false NOT NULL,
|
579
|
+
created_at timestamp without time zone NOT NULL,
|
580
|
+
created_by_id integer NOT NULL,
|
581
|
+
updated_at timestamp without time zone NOT NULL,
|
582
|
+
updated_by_id integer NOT NULL
|
583
|
+
);
|
584
|
+
|
585
|
+
|
586
|
+
--
|
587
|
+
-- Name: skr_inv_details; Type: VIEW; Schema: public; Owner: -
|
588
|
+
--
|
589
|
+
|
590
|
+
CREATE VIEW skr_inv_details AS
|
591
|
+
SELECT inv.id AS invoice_id,
|
592
|
+
so.visible_id AS sales_order_visible_id,
|
593
|
+
pt.id AS pick_ticket_id,
|
594
|
+
to_char(so.created_at, 'YYYY-MM-DD'::text) AS string_order_date,
|
595
|
+
to_char(inv.created_at, 'YYYY-MM-DD'::text) AS string_invoice_date,
|
596
|
+
cust.code AS customer_code,
|
597
|
+
cust.name AS customer_name,
|
598
|
+
ba.name AS bill_addr_name,
|
599
|
+
COALESCE(ttls.total, 0.0) AS total,
|
600
|
+
COALESCE(ttls.num_lines, (0)::bigint) AS num_lines,
|
601
|
+
COALESCE(ttls.other_charge_total, (0)::numeric) AS total_other_charge_amount,
|
602
|
+
(COALESCE(ttls.total, 0.0) - COALESCE(ttls.other_charge_total, 0.0)) AS subtotal_amount
|
603
|
+
FROM (((((skr_invoices inv
|
604
|
+
JOIN skr_customers cust ON ((cust.id = inv.customer_id)))
|
605
|
+
LEFT JOIN skr_addresses ba ON ((ba.id = inv.billing_address_id)))
|
606
|
+
LEFT JOIN skr_sales_orders so ON ((so.id = inv.sales_order_id)))
|
607
|
+
LEFT JOIN skr_pick_tickets pt ON ((pt.id = inv.pick_ticket_id)))
|
608
|
+
LEFT JOIN ( SELECT ivl.invoice_id,
|
609
|
+
sum(((ivl.qty)::numeric * ivl.price)) AS total,
|
610
|
+
sum(
|
611
|
+
CASE
|
612
|
+
WHEN s.is_other_charge THEN ((ivl.qty)::numeric * ivl.price)
|
613
|
+
ELSE (0)::numeric
|
614
|
+
END) AS other_charge_total,
|
615
|
+
count(ivl.*) AS num_lines
|
616
|
+
FROM ((skr_inv_lines ivl
|
617
|
+
JOIN skr_sku_locs sl ON ((sl.id = ivl.sku_loc_id)))
|
618
|
+
JOIN skr_skus s ON ((s.id = sl.sku_id)))
|
619
|
+
GROUP BY ivl.invoice_id) ttls ON ((ttls.invoice_id = inv.id)));
|
620
|
+
|
621
|
+
|
622
|
+
--
|
623
|
+
-- Name: skr_inv_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
624
|
+
--
|
625
|
+
|
626
|
+
CREATE SEQUENCE skr_inv_lines_id_seq
|
627
|
+
START WITH 1
|
628
|
+
INCREMENT BY 1
|
629
|
+
NO MINVALUE
|
630
|
+
NO MAXVALUE
|
631
|
+
CACHE 1;
|
632
|
+
|
633
|
+
|
634
|
+
--
|
635
|
+
-- Name: skr_inv_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
636
|
+
--
|
637
|
+
|
638
|
+
ALTER SEQUENCE skr_inv_lines_id_seq OWNED BY skr_inv_lines.id;
|
639
|
+
|
640
|
+
|
641
|
+
--
|
642
|
+
-- Name: skr_inventory_adjustments; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
643
|
+
--
|
644
|
+
|
645
|
+
CREATE TABLE skr_inventory_adjustments (
|
646
|
+
id integer NOT NULL,
|
647
|
+
visible_id integer NOT NULL,
|
648
|
+
location_id integer NOT NULL,
|
649
|
+
reason_id integer NOT NULL,
|
650
|
+
state character varying NOT NULL,
|
651
|
+
description text NOT NULL,
|
652
|
+
created_at timestamp without time zone NOT NULL,
|
653
|
+
created_by_id integer NOT NULL,
|
654
|
+
updated_at timestamp without time zone NOT NULL,
|
655
|
+
updated_by_id integer NOT NULL
|
656
|
+
);
|
657
|
+
|
658
|
+
|
659
|
+
--
|
660
|
+
-- Name: skr_inventory_adjustments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
661
|
+
--
|
662
|
+
|
663
|
+
CREATE SEQUENCE skr_inventory_adjustments_id_seq
|
664
|
+
START WITH 1
|
665
|
+
INCREMENT BY 1
|
666
|
+
NO MINVALUE
|
667
|
+
NO MAXVALUE
|
668
|
+
CACHE 1;
|
669
|
+
|
670
|
+
|
671
|
+
--
|
672
|
+
-- Name: skr_inventory_adjustments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
673
|
+
--
|
674
|
+
|
675
|
+
ALTER SEQUENCE skr_inventory_adjustments_id_seq OWNED BY skr_inventory_adjustments.id;
|
676
|
+
|
677
|
+
|
678
|
+
--
|
679
|
+
-- Name: skr_invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
680
|
+
--
|
681
|
+
|
682
|
+
CREATE SEQUENCE skr_invoices_id_seq
|
683
|
+
START WITH 1
|
684
|
+
INCREMENT BY 1
|
685
|
+
NO MINVALUE
|
686
|
+
NO MAXVALUE
|
687
|
+
CACHE 1;
|
688
|
+
|
689
|
+
|
690
|
+
--
|
691
|
+
-- Name: skr_invoices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
692
|
+
--
|
693
|
+
|
694
|
+
ALTER SEQUENCE skr_invoices_id_seq OWNED BY skr_invoices.id;
|
695
|
+
|
696
|
+
|
697
|
+
--
|
698
|
+
-- Name: skr_locations; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
699
|
+
--
|
700
|
+
|
701
|
+
CREATE TABLE skr_locations (
|
702
|
+
id integer NOT NULL,
|
703
|
+
code character varying NOT NULL,
|
704
|
+
name character varying NOT NULL,
|
705
|
+
address_id integer NOT NULL,
|
706
|
+
is_active boolean DEFAULT true NOT NULL,
|
707
|
+
gl_branch_code character varying(2) DEFAULT '01'::character varying NOT NULL,
|
708
|
+
created_at timestamp without time zone NOT NULL,
|
709
|
+
created_by_id integer NOT NULL,
|
710
|
+
updated_at timestamp without time zone NOT NULL,
|
711
|
+
updated_by_id integer NOT NULL
|
712
|
+
);
|
713
|
+
|
714
|
+
|
715
|
+
--
|
716
|
+
-- Name: skr_locations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
717
|
+
--
|
718
|
+
|
719
|
+
CREATE SEQUENCE skr_locations_id_seq
|
720
|
+
START WITH 1
|
721
|
+
INCREMENT BY 1
|
722
|
+
NO MINVALUE
|
723
|
+
NO MAXVALUE
|
724
|
+
CACHE 1;
|
725
|
+
|
726
|
+
|
727
|
+
--
|
728
|
+
-- Name: skr_locations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
729
|
+
--
|
730
|
+
|
731
|
+
ALTER SEQUENCE skr_locations_id_seq OWNED BY skr_locations.id;
|
732
|
+
|
733
|
+
|
734
|
+
--
|
735
|
+
-- Name: skr_payment_terms; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
736
|
+
--
|
737
|
+
|
738
|
+
CREATE TABLE skr_payment_terms (
|
739
|
+
id integer NOT NULL,
|
740
|
+
code character varying NOT NULL,
|
741
|
+
days integer DEFAULT 0 NOT NULL,
|
742
|
+
description character varying NOT NULL,
|
743
|
+
discount_days integer,
|
744
|
+
discount_amount character varying,
|
745
|
+
created_at timestamp without time zone NOT NULL,
|
746
|
+
created_by_id integer NOT NULL,
|
747
|
+
updated_at timestamp without time zone NOT NULL,
|
748
|
+
updated_by_id integer NOT NULL
|
749
|
+
);
|
750
|
+
|
751
|
+
|
752
|
+
--
|
753
|
+
-- Name: skr_payment_terms_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
754
|
+
--
|
755
|
+
|
756
|
+
CREATE SEQUENCE skr_payment_terms_id_seq
|
757
|
+
START WITH 1
|
758
|
+
INCREMENT BY 1
|
759
|
+
NO MINVALUE
|
760
|
+
NO MAXVALUE
|
761
|
+
CACHE 1;
|
762
|
+
|
763
|
+
|
764
|
+
--
|
765
|
+
-- Name: skr_payment_terms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
766
|
+
--
|
767
|
+
|
768
|
+
ALTER SEQUENCE skr_payment_terms_id_seq OWNED BY skr_payment_terms.id;
|
769
|
+
|
770
|
+
|
771
|
+
--
|
772
|
+
-- Name: skr_pick_tickets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
773
|
+
--
|
774
|
+
|
775
|
+
CREATE SEQUENCE skr_pick_tickets_id_seq
|
776
|
+
START WITH 1
|
777
|
+
INCREMENT BY 1
|
778
|
+
NO MINVALUE
|
779
|
+
NO MAXVALUE
|
780
|
+
CACHE 1;
|
781
|
+
|
782
|
+
|
783
|
+
--
|
784
|
+
-- Name: skr_pick_tickets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
785
|
+
--
|
786
|
+
|
787
|
+
ALTER SEQUENCE skr_pick_tickets_id_seq OWNED BY skr_pick_tickets.id;
|
788
|
+
|
789
|
+
|
790
|
+
--
|
791
|
+
-- Name: skr_po_lines; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
792
|
+
--
|
793
|
+
|
794
|
+
CREATE TABLE skr_po_lines (
|
795
|
+
id integer NOT NULL,
|
796
|
+
purchase_order_id integer NOT NULL,
|
797
|
+
sku_loc_id integer NOT NULL,
|
798
|
+
sku_vendor_id integer NOT NULL,
|
799
|
+
part_code character varying NOT NULL,
|
800
|
+
sku_code character varying NOT NULL,
|
801
|
+
description character varying NOT NULL,
|
802
|
+
uom_code character varying NOT NULL,
|
803
|
+
uom_size smallint NOT NULL,
|
804
|
+
"position" smallint NOT NULL,
|
805
|
+
qty integer DEFAULT 0 NOT NULL,
|
806
|
+
qty_received integer DEFAULT 0 NOT NULL,
|
807
|
+
qty_canceled integer DEFAULT 0 NOT NULL,
|
808
|
+
price numeric(15,2) NOT NULL,
|
809
|
+
is_revised boolean DEFAULT false NOT NULL,
|
810
|
+
created_at timestamp without time zone NOT NULL,
|
811
|
+
created_by_id integer NOT NULL,
|
812
|
+
updated_at timestamp without time zone NOT NULL,
|
813
|
+
updated_by_id integer NOT NULL
|
814
|
+
);
|
815
|
+
|
816
|
+
|
817
|
+
--
|
818
|
+
-- Name: skr_po_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
819
|
+
--
|
820
|
+
|
821
|
+
CREATE SEQUENCE skr_po_lines_id_seq
|
822
|
+
START WITH 1
|
823
|
+
INCREMENT BY 1
|
824
|
+
NO MINVALUE
|
825
|
+
NO MAXVALUE
|
826
|
+
CACHE 1;
|
827
|
+
|
828
|
+
|
829
|
+
--
|
830
|
+
-- Name: skr_po_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
831
|
+
--
|
832
|
+
|
833
|
+
ALTER SEQUENCE skr_po_lines_id_seq OWNED BY skr_po_lines.id;
|
834
|
+
|
835
|
+
|
836
|
+
--
|
837
|
+
-- Name: skr_po_receipts; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
838
|
+
--
|
839
|
+
|
840
|
+
CREATE TABLE skr_po_receipts (
|
841
|
+
id integer NOT NULL,
|
842
|
+
visible_id integer NOT NULL,
|
843
|
+
location_id integer NOT NULL,
|
844
|
+
freight numeric(15,2) DEFAULT 0.0 NOT NULL,
|
845
|
+
purchase_order_id integer NOT NULL,
|
846
|
+
vendor_id integer NOT NULL,
|
847
|
+
voucher_id integer,
|
848
|
+
refno character varying,
|
849
|
+
created_at timestamp without time zone NOT NULL,
|
850
|
+
created_by_id integer NOT NULL
|
851
|
+
);
|
852
|
+
|
853
|
+
|
854
|
+
--
|
855
|
+
-- Name: skr_po_receipts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
856
|
+
--
|
857
|
+
|
858
|
+
CREATE SEQUENCE skr_po_receipts_id_seq
|
859
|
+
START WITH 1
|
860
|
+
INCREMENT BY 1
|
861
|
+
NO MINVALUE
|
862
|
+
NO MAXVALUE
|
863
|
+
CACHE 1;
|
864
|
+
|
865
|
+
|
866
|
+
--
|
867
|
+
-- Name: skr_po_receipts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
868
|
+
--
|
869
|
+
|
870
|
+
ALTER SEQUENCE skr_po_receipts_id_seq OWNED BY skr_po_receipts.id;
|
871
|
+
|
872
|
+
|
873
|
+
--
|
874
|
+
-- Name: skr_por_lines; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
875
|
+
--
|
876
|
+
|
877
|
+
CREATE TABLE skr_por_lines (
|
878
|
+
id integer NOT NULL,
|
879
|
+
po_receipt_id integer NOT NULL,
|
880
|
+
po_line_id integer,
|
881
|
+
sku_loc_id integer NOT NULL,
|
882
|
+
sku_vendor_id integer,
|
883
|
+
sku_code character varying NOT NULL,
|
884
|
+
part_code character varying NOT NULL,
|
885
|
+
description character varying NOT NULL,
|
886
|
+
uom_code character varying NOT NULL,
|
887
|
+
uom_size smallint NOT NULL,
|
888
|
+
"position" smallint NOT NULL,
|
889
|
+
qty integer DEFAULT 0 NOT NULL,
|
890
|
+
price numeric(15,2) NOT NULL,
|
891
|
+
created_at timestamp without time zone NOT NULL,
|
892
|
+
created_by_id integer NOT NULL
|
893
|
+
);
|
894
|
+
|
895
|
+
|
896
|
+
--
|
897
|
+
-- Name: skr_por_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
898
|
+
--
|
899
|
+
|
900
|
+
CREATE SEQUENCE skr_por_lines_id_seq
|
901
|
+
START WITH 1
|
902
|
+
INCREMENT BY 1
|
903
|
+
NO MINVALUE
|
904
|
+
NO MAXVALUE
|
905
|
+
CACHE 1;
|
906
|
+
|
907
|
+
|
908
|
+
--
|
909
|
+
-- Name: skr_por_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
910
|
+
--
|
911
|
+
|
912
|
+
ALTER SEQUENCE skr_por_lines_id_seq OWNED BY skr_por_lines.id;
|
913
|
+
|
914
|
+
|
915
|
+
--
|
916
|
+
-- Name: skr_pt_lines; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
917
|
+
--
|
918
|
+
|
919
|
+
CREATE TABLE skr_pt_lines (
|
920
|
+
id integer NOT NULL,
|
921
|
+
pick_ticket_id integer NOT NULL,
|
922
|
+
so_line_id integer NOT NULL,
|
923
|
+
sku_loc_id integer NOT NULL,
|
924
|
+
price numeric(15,2) NOT NULL,
|
925
|
+
sku_code character varying NOT NULL,
|
926
|
+
description character varying NOT NULL,
|
927
|
+
uom_code character varying NOT NULL,
|
928
|
+
bin character varying,
|
929
|
+
uom_size smallint NOT NULL,
|
930
|
+
"position" smallint NOT NULL,
|
931
|
+
qty integer DEFAULT 0 NOT NULL,
|
932
|
+
qty_invoiced integer DEFAULT 0 NOT NULL,
|
933
|
+
is_complete boolean DEFAULT false NOT NULL
|
934
|
+
);
|
935
|
+
|
936
|
+
|
937
|
+
--
|
938
|
+
-- Name: skr_pt_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
939
|
+
--
|
940
|
+
|
941
|
+
CREATE SEQUENCE skr_pt_lines_id_seq
|
942
|
+
START WITH 1
|
943
|
+
INCREMENT BY 1
|
944
|
+
NO MINVALUE
|
945
|
+
NO MAXVALUE
|
946
|
+
CACHE 1;
|
947
|
+
|
948
|
+
|
949
|
+
--
|
950
|
+
-- Name: skr_pt_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
951
|
+
--
|
952
|
+
|
953
|
+
ALTER SEQUENCE skr_pt_lines_id_seq OWNED BY skr_pt_lines.id;
|
954
|
+
|
955
|
+
|
956
|
+
--
|
957
|
+
-- Name: skr_purchase_orders; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
958
|
+
--
|
959
|
+
|
960
|
+
CREATE TABLE skr_purchase_orders (
|
961
|
+
id integer NOT NULL,
|
962
|
+
visible_id integer NOT NULL,
|
963
|
+
vendor_id integer NOT NULL,
|
964
|
+
location_id integer NOT NULL,
|
965
|
+
ship_addr_id integer NOT NULL,
|
966
|
+
terms_id integer NOT NULL,
|
967
|
+
state character varying NOT NULL,
|
968
|
+
is_revised boolean DEFAULT false NOT NULL,
|
969
|
+
order_date date NOT NULL,
|
970
|
+
receiving_completed_at timestamp without time zone,
|
971
|
+
created_at timestamp without time zone NOT NULL,
|
972
|
+
created_by_id integer NOT NULL,
|
973
|
+
updated_at timestamp without time zone NOT NULL,
|
974
|
+
updated_by_id integer NOT NULL
|
975
|
+
);
|
976
|
+
|
977
|
+
|
978
|
+
--
|
979
|
+
-- Name: skr_purchase_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
980
|
+
--
|
981
|
+
|
982
|
+
CREATE SEQUENCE skr_purchase_orders_id_seq
|
983
|
+
START WITH 1
|
984
|
+
INCREMENT BY 1
|
985
|
+
NO MINVALUE
|
986
|
+
NO MAXVALUE
|
987
|
+
CACHE 1;
|
988
|
+
|
989
|
+
|
990
|
+
--
|
991
|
+
-- Name: skr_purchase_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
992
|
+
--
|
993
|
+
|
994
|
+
ALTER SEQUENCE skr_purchase_orders_id_seq OWNED BY skr_purchase_orders.id;
|
995
|
+
|
996
|
+
|
997
|
+
--
|
998
|
+
-- Name: skr_sales_orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
999
|
+
--
|
1000
|
+
|
1001
|
+
CREATE SEQUENCE skr_sales_orders_id_seq
|
1002
|
+
START WITH 1
|
1003
|
+
INCREMENT BY 1
|
1004
|
+
NO MINVALUE
|
1005
|
+
NO MAXVALUE
|
1006
|
+
CACHE 1;
|
1007
|
+
|
1008
|
+
|
1009
|
+
--
|
1010
|
+
-- Name: skr_sales_orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1011
|
+
--
|
1012
|
+
|
1013
|
+
ALTER SEQUENCE skr_sales_orders_id_seq OWNED BY skr_sales_orders.id;
|
1014
|
+
|
1015
|
+
|
1016
|
+
--
|
1017
|
+
-- Name: skr_sequential_ids; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1018
|
+
--
|
1019
|
+
|
1020
|
+
CREATE TABLE skr_sequential_ids (
|
1021
|
+
name character varying NOT NULL,
|
1022
|
+
current_value integer DEFAULT 0 NOT NULL
|
1023
|
+
);
|
1024
|
+
|
1025
|
+
|
1026
|
+
--
|
1027
|
+
-- Name: skr_sku_vendors; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1028
|
+
--
|
1029
|
+
|
1030
|
+
CREATE TABLE skr_sku_vendors (
|
1031
|
+
id integer NOT NULL,
|
1032
|
+
sku_id integer NOT NULL,
|
1033
|
+
vendor_id integer NOT NULL,
|
1034
|
+
list_price numeric(15,2) NOT NULL,
|
1035
|
+
part_code character varying NOT NULL,
|
1036
|
+
is_active boolean DEFAULT true NOT NULL,
|
1037
|
+
uom_size integer DEFAULT 1 NOT NULL,
|
1038
|
+
uom_code character varying DEFAULT 'EA'::character varying NOT NULL,
|
1039
|
+
cost numeric(15,2) NOT NULL,
|
1040
|
+
created_at timestamp without time zone NOT NULL,
|
1041
|
+
created_by_id integer NOT NULL,
|
1042
|
+
updated_at timestamp without time zone NOT NULL,
|
1043
|
+
updated_by_id integer NOT NULL
|
1044
|
+
);
|
1045
|
+
|
1046
|
+
|
1047
|
+
--
|
1048
|
+
-- Name: skr_uoms; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1049
|
+
--
|
1050
|
+
|
1051
|
+
CREATE TABLE skr_uoms (
|
1052
|
+
id integer NOT NULL,
|
1053
|
+
sku_id integer NOT NULL,
|
1054
|
+
price numeric(15,2) NOT NULL,
|
1055
|
+
size smallint DEFAULT 1 NOT NULL,
|
1056
|
+
code character varying DEFAULT 'EA'::character varying NOT NULL,
|
1057
|
+
weight numeric(6,1),
|
1058
|
+
height numeric(6,1),
|
1059
|
+
width numeric(6,1),
|
1060
|
+
depth numeric(6,1),
|
1061
|
+
created_at timestamp without time zone NOT NULL,
|
1062
|
+
created_by_id integer NOT NULL,
|
1063
|
+
updated_at timestamp without time zone NOT NULL,
|
1064
|
+
updated_by_id integer NOT NULL
|
1065
|
+
);
|
1066
|
+
|
1067
|
+
|
1068
|
+
--
|
1069
|
+
-- Name: skr_vendors; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1070
|
+
--
|
1071
|
+
|
1072
|
+
CREATE TABLE skr_vendors (
|
1073
|
+
id integer NOT NULL,
|
1074
|
+
billing_address_id integer NOT NULL,
|
1075
|
+
shipping_address_id integer NOT NULL,
|
1076
|
+
terms_id integer NOT NULL,
|
1077
|
+
gl_payables_account_id integer NOT NULL,
|
1078
|
+
gl_freight_account_id integer NOT NULL,
|
1079
|
+
code character varying NOT NULL,
|
1080
|
+
hash_code character varying NOT NULL,
|
1081
|
+
name character varying NOT NULL,
|
1082
|
+
notes text,
|
1083
|
+
account_code character varying,
|
1084
|
+
website character varying,
|
1085
|
+
created_at timestamp without time zone NOT NULL,
|
1086
|
+
created_by_id integer NOT NULL,
|
1087
|
+
updated_at timestamp without time zone NOT NULL,
|
1088
|
+
updated_by_id integer NOT NULL
|
1089
|
+
);
|
1090
|
+
|
1091
|
+
|
1092
|
+
--
|
1093
|
+
-- Name: skr_sku_loc_details; Type: VIEW; Schema: public; Owner: -
|
1094
|
+
--
|
1095
|
+
|
1096
|
+
CREATE VIEW skr_sku_loc_details AS
|
1097
|
+
SELECT sl.id AS sku_loc_id,
|
1098
|
+
s.code AS sku_code,
|
1099
|
+
s.description AS sku_description,
|
1100
|
+
s.default_uom_code,
|
1101
|
+
uom.id AS default_uom_id,
|
1102
|
+
COALESCE((uom.size)::integer, 1) AS default_uom_size,
|
1103
|
+
COALESCE(uom.price, 0.0) AS default_price,
|
1104
|
+
v.code AS vendor_code,
|
1105
|
+
v.name AS vendor_name,
|
1106
|
+
sv.part_code AS vendor_part_code,
|
1107
|
+
sv.cost AS purchase_cost
|
1108
|
+
FROM ((((skr_sku_locs sl
|
1109
|
+
JOIN skr_skus s ON ((s.id = sl.sku_id)))
|
1110
|
+
LEFT JOIN skr_uoms uom ON (((uom.sku_id = s.id) AND ((uom.code)::text = (s.default_uom_code)::text))))
|
1111
|
+
JOIN skr_vendors v ON ((s.default_vendor_id = v.id)))
|
1112
|
+
JOIN skr_sku_vendors sv ON (((sv.vendor_id = v.id) AND (sv.sku_id = s.id))));
|
1113
|
+
|
1114
|
+
|
1115
|
+
--
|
1116
|
+
-- Name: skr_sku_locs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1117
|
+
--
|
1118
|
+
|
1119
|
+
CREATE SEQUENCE skr_sku_locs_id_seq
|
1120
|
+
START WITH 1
|
1121
|
+
INCREMENT BY 1
|
1122
|
+
NO MINVALUE
|
1123
|
+
NO MAXVALUE
|
1124
|
+
CACHE 1;
|
1125
|
+
|
1126
|
+
|
1127
|
+
--
|
1128
|
+
-- Name: skr_sku_locs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1129
|
+
--
|
1130
|
+
|
1131
|
+
ALTER SEQUENCE skr_sku_locs_id_seq OWNED BY skr_sku_locs.id;
|
1132
|
+
|
1133
|
+
|
1134
|
+
--
|
1135
|
+
-- Name: skr_so_lines; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1136
|
+
--
|
1137
|
+
|
1138
|
+
CREATE TABLE skr_so_lines (
|
1139
|
+
id integer NOT NULL,
|
1140
|
+
sales_order_id integer NOT NULL,
|
1141
|
+
sku_loc_id integer NOT NULL,
|
1142
|
+
price numeric(15,2) NOT NULL,
|
1143
|
+
sku_code character varying NOT NULL,
|
1144
|
+
description character varying NOT NULL,
|
1145
|
+
uom_code character varying NOT NULL,
|
1146
|
+
uom_size smallint NOT NULL,
|
1147
|
+
"position" smallint NOT NULL,
|
1148
|
+
qty integer DEFAULT 0 NOT NULL,
|
1149
|
+
qty_allocated integer DEFAULT 0 NOT NULL,
|
1150
|
+
qty_picking integer DEFAULT 0 NOT NULL,
|
1151
|
+
qty_invoiced integer DEFAULT 0 NOT NULL,
|
1152
|
+
qty_canceled integer DEFAULT 0 NOT NULL,
|
1153
|
+
is_revised boolean DEFAULT false NOT NULL,
|
1154
|
+
created_at timestamp without time zone NOT NULL,
|
1155
|
+
created_by_id integer NOT NULL,
|
1156
|
+
updated_at timestamp without time zone NOT NULL,
|
1157
|
+
updated_by_id integer NOT NULL
|
1158
|
+
);
|
1159
|
+
|
1160
|
+
|
1161
|
+
--
|
1162
|
+
-- Name: skr_sku_qty_details; Type: VIEW; Schema: public; Owner: -
|
1163
|
+
--
|
1164
|
+
|
1165
|
+
CREATE VIEW skr_sku_qty_details AS
|
1166
|
+
SELECT s.id AS sku_id,
|
1167
|
+
sl_ttl.qty AS qty_on_hand,
|
1168
|
+
COALESCE(sol_ttl.qty, (0)::bigint) AS qty_on_orders,
|
1169
|
+
COALESCE(pol_ttl.qty, (0)::bigint) AS qty_incoming
|
1170
|
+
FROM (((skr_skus s
|
1171
|
+
JOIN ( SELECT sum(sl.qty) AS qty,
|
1172
|
+
sl.sku_id
|
1173
|
+
FROM skr_sku_locs sl
|
1174
|
+
GROUP BY sl.sku_id) sl_ttl ON ((sl_ttl.sku_id = s.id)))
|
1175
|
+
LEFT JOIN ( SELECT s_1.id AS sku_id,
|
1176
|
+
sum(((sol.qty - sol.qty_canceled) * sol.uom_size)) AS qty
|
1177
|
+
FROM (((skr_so_lines sol
|
1178
|
+
JOIN skr_sales_orders so ON (((so.id = sol.sales_order_id) AND ((so.state)::text <> ALL ((ARRAY['canceled'::character varying, 'complete'::character varying])::text[])))))
|
1179
|
+
JOIN skr_sku_locs sl ON ((sl.id = sol.sku_loc_id)))
|
1180
|
+
JOIN skr_skus s_1 ON ((s_1.id = sl.sku_id)))
|
1181
|
+
GROUP BY s_1.id) sol_ttl ON ((sol_ttl.sku_id = s.id)))
|
1182
|
+
LEFT JOIN ( SELECT s_1.id AS sku_id,
|
1183
|
+
sum(((pol.qty - pol.qty_canceled) * pol.uom_size)) AS qty
|
1184
|
+
FROM (((skr_po_lines pol
|
1185
|
+
JOIN skr_purchase_orders po ON (((po.id = pol.purchase_order_id) AND ((po.state)::text <> ALL ((ARRAY['canceled'::character varying, 'complete'::character varying])::text[])))))
|
1186
|
+
JOIN skr_sku_locs sl ON ((sl.id = pol.sku_loc_id)))
|
1187
|
+
JOIN skr_skus s_1 ON ((s_1.id = sl.sku_id)))
|
1188
|
+
GROUP BY s_1.id) pol_ttl ON ((pol_ttl.sku_id = s.id)));
|
1189
|
+
|
1190
|
+
|
1191
|
+
--
|
1192
|
+
-- Name: skr_sku_trans; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1193
|
+
--
|
1194
|
+
|
1195
|
+
CREATE TABLE skr_sku_trans (
|
1196
|
+
id integer NOT NULL,
|
1197
|
+
origin_id integer,
|
1198
|
+
origin_type character varying,
|
1199
|
+
sku_loc_id integer NOT NULL,
|
1200
|
+
cost numeric(15,2) NOT NULL,
|
1201
|
+
origin_description character varying NOT NULL,
|
1202
|
+
prior_qty integer NOT NULL,
|
1203
|
+
mac numeric(15,4) NOT NULL,
|
1204
|
+
prior_mac numeric(15,4) NOT NULL,
|
1205
|
+
qty integer DEFAULT 0 NOT NULL,
|
1206
|
+
uom_code character varying DEFAULT 'EA'::character varying NOT NULL,
|
1207
|
+
uom_size integer DEFAULT 1 NOT NULL,
|
1208
|
+
created_at timestamp without time zone NOT NULL,
|
1209
|
+
created_by_id integer NOT NULL
|
1210
|
+
);
|
1211
|
+
|
1212
|
+
|
1213
|
+
--
|
1214
|
+
-- Name: skr_sku_trans_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1215
|
+
--
|
1216
|
+
|
1217
|
+
CREATE SEQUENCE skr_sku_trans_id_seq
|
1218
|
+
START WITH 1
|
1219
|
+
INCREMENT BY 1
|
1220
|
+
NO MINVALUE
|
1221
|
+
NO MAXVALUE
|
1222
|
+
CACHE 1;
|
1223
|
+
|
1224
|
+
|
1225
|
+
--
|
1226
|
+
-- Name: skr_sku_trans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1227
|
+
--
|
1228
|
+
|
1229
|
+
ALTER SEQUENCE skr_sku_trans_id_seq OWNED BY skr_sku_trans.id;
|
1230
|
+
|
1231
|
+
|
1232
|
+
--
|
1233
|
+
-- Name: skr_sku_vendors_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1234
|
+
--
|
1235
|
+
|
1236
|
+
CREATE SEQUENCE skr_sku_vendors_id_seq
|
1237
|
+
START WITH 1
|
1238
|
+
INCREMENT BY 1
|
1239
|
+
NO MINVALUE
|
1240
|
+
NO MAXVALUE
|
1241
|
+
CACHE 1;
|
1242
|
+
|
1243
|
+
|
1244
|
+
--
|
1245
|
+
-- Name: skr_sku_vendors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1246
|
+
--
|
1247
|
+
|
1248
|
+
ALTER SEQUENCE skr_sku_vendors_id_seq OWNED BY skr_sku_vendors.id;
|
1249
|
+
|
1250
|
+
|
1251
|
+
--
|
1252
|
+
-- Name: skr_skus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1253
|
+
--
|
1254
|
+
|
1255
|
+
CREATE SEQUENCE skr_skus_id_seq
|
1256
|
+
START WITH 1
|
1257
|
+
INCREMENT BY 1
|
1258
|
+
NO MINVALUE
|
1259
|
+
NO MAXVALUE
|
1260
|
+
CACHE 1;
|
1261
|
+
|
1262
|
+
|
1263
|
+
--
|
1264
|
+
-- Name: skr_skus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1265
|
+
--
|
1266
|
+
|
1267
|
+
ALTER SEQUENCE skr_skus_id_seq OWNED BY skr_skus.id;
|
1268
|
+
|
1269
|
+
|
1270
|
+
--
|
1271
|
+
-- Name: skr_so_allocation_details; Type: VIEW; Schema: public; Owner: -
|
1272
|
+
--
|
1273
|
+
|
1274
|
+
CREATE VIEW skr_so_allocation_details AS
|
1275
|
+
SELECT sol.sales_order_id,
|
1276
|
+
count(*) AS number_of_lines,
|
1277
|
+
sum(((sol.qty_allocated)::numeric * sol.price)) AS allocated_total,
|
1278
|
+
sum(
|
1279
|
+
CASE
|
1280
|
+
WHEN (((sol.qty_allocated - sol.qty_canceled) - sol.qty_picking) > 0) THEN 1
|
1281
|
+
ELSE 0
|
1282
|
+
END) AS number_of_lines_allocated,
|
1283
|
+
sum(
|
1284
|
+
CASE
|
1285
|
+
WHEN (sol.qty_allocated = ((sol.qty - sol.qty_canceled) - sol.qty_picking)) THEN 1
|
1286
|
+
ELSE 0
|
1287
|
+
END) AS number_of_lines_fully_allocated
|
1288
|
+
FROM ((skr_so_lines sol
|
1289
|
+
JOIN skr_sku_locs sl ON ((sl.id = sol.sku_loc_id)))
|
1290
|
+
JOIN skr_skus s ON (((s.id = sl.sku_id) AND (s.is_other_charge = false))))
|
1291
|
+
GROUP BY sol.sales_order_id
|
1292
|
+
HAVING (sum(
|
1293
|
+
CASE
|
1294
|
+
WHEN (((sol.qty_allocated - sol.qty_canceled) - sol.qty_picking) > 0) THEN 1
|
1295
|
+
ELSE 0
|
1296
|
+
END) > 0);
|
1297
|
+
|
1298
|
+
|
1299
|
+
--
|
1300
|
+
-- Name: skr_so_amount_details; Type: VIEW; Schema: public; Owner: -
|
1301
|
+
--
|
1302
|
+
|
1303
|
+
CREATE VIEW skr_so_amount_details AS
|
1304
|
+
SELECT so.id AS sales_order_id,
|
1305
|
+
to_char((so.order_date)::timestamp with time zone, 'YYYY-MM-DD'::text) AS string_order_date,
|
1306
|
+
cust.code AS customer_code,
|
1307
|
+
cust.name AS customer_name,
|
1308
|
+
addr.name AS bill_addr_name,
|
1309
|
+
COALESCE(ttls.total, 0.0) AS total,
|
1310
|
+
COALESCE(ttls.num_lines, (0)::bigint) AS num_lines,
|
1311
|
+
COALESCE(ttls.other_charge_total, (0)::numeric) AS total_other_charge_amount,
|
1312
|
+
COALESCE(ttls.tax_charge_total, (0)::numeric) AS total_tax_amount,
|
1313
|
+
COALESCE(ttls.shipping_charge_total, (0)::numeric) AS total_shipping_amount,
|
1314
|
+
(COALESCE(ttls.total, 0.0) - COALESCE(ttls.other_charge_total, 0.0)) AS subtotal_amount
|
1315
|
+
FROM (((skr_sales_orders so
|
1316
|
+
JOIN skr_customers cust ON ((cust.id = so.customer_id)))
|
1317
|
+
JOIN skr_addresses addr ON ((addr.id = so.billing_address_id)))
|
1318
|
+
LEFT JOIN ( SELECT sol.sales_order_id,
|
1319
|
+
sum(((sol.qty)::numeric * sol.price)) AS total,
|
1320
|
+
sum(
|
1321
|
+
CASE
|
1322
|
+
WHEN s.is_other_charge THEN ((sol.qty)::numeric * sol.price)
|
1323
|
+
ELSE (0)::numeric
|
1324
|
+
END) AS other_charge_total,
|
1325
|
+
sum(
|
1326
|
+
CASE
|
1327
|
+
WHEN ((sol.sku_code)::text = 'SHIP'::text) THEN ((sol.qty)::numeric * sol.price)
|
1328
|
+
ELSE (0)::numeric
|
1329
|
+
END) AS shipping_charge_total,
|
1330
|
+
sum(
|
1331
|
+
CASE
|
1332
|
+
WHEN ((sol.sku_code)::text = 'TAX'::text) THEN ((sol.qty)::numeric * sol.price)
|
1333
|
+
ELSE (0)::numeric
|
1334
|
+
END) AS tax_charge_total,
|
1335
|
+
count(sol.*) AS num_lines
|
1336
|
+
FROM ((skr_so_lines sol
|
1337
|
+
JOIN skr_sku_locs sl ON ((sl.id = sol.sku_loc_id)))
|
1338
|
+
JOIN skr_skus s ON ((s.id = sl.sku_id)))
|
1339
|
+
GROUP BY sol.sales_order_id) ttls ON ((ttls.sales_order_id = so.id)));
|
1340
|
+
|
1341
|
+
|
1342
|
+
--
|
1343
|
+
-- Name: skr_so_dailly_sales_history; Type: VIEW; Schema: public; Owner: -
|
1344
|
+
--
|
1345
|
+
|
1346
|
+
CREATE VIEW skr_so_dailly_sales_history AS
|
1347
|
+
SELECT days_ago.days_ago,
|
1348
|
+
date_trunc('day'::text, ((('now'::text)::date - days_ago.days_ago))::timestamp with time zone) AS day,
|
1349
|
+
COALESCE(ttls.order_count, (0)::bigint) AS order_count,
|
1350
|
+
COALESCE(ttls.line_count, (0)::bigint) AS line_count,
|
1351
|
+
COALESCE(ttls.total, 0.0) AS total
|
1352
|
+
FROM (generate_series(0, 120, 1) days_ago(days_ago)
|
1353
|
+
LEFT JOIN ( SELECT count(DISTINCT sol.sales_order_id) AS order_count,
|
1354
|
+
count(*) AS line_count,
|
1355
|
+
sum((sol.price * (sol.qty)::numeric)) AS total,
|
1356
|
+
date_trunc('day'::text, so.created_at) AS so_date
|
1357
|
+
FROM (skr_so_lines sol
|
1358
|
+
JOIN skr_sales_orders so ON ((sol.sales_order_id = so.id)))
|
1359
|
+
GROUP BY date_trunc('day'::text, so.created_at)) ttls ON ((ttls.so_date = date_trunc('day'::text, ((('now'::text)::date - days_ago.days_ago))::timestamp with time zone))))
|
1360
|
+
ORDER BY date_trunc('day'::text, ((('now'::text)::date - days_ago.days_ago))::timestamp with time zone) DESC;
|
1361
|
+
|
1362
|
+
|
1363
|
+
--
|
1364
|
+
-- Name: skr_so_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1365
|
+
--
|
1366
|
+
|
1367
|
+
CREATE SEQUENCE skr_so_lines_id_seq
|
1368
|
+
START WITH 1
|
1369
|
+
INCREMENT BY 1
|
1370
|
+
NO MINVALUE
|
1371
|
+
NO MAXVALUE
|
1372
|
+
CACHE 1;
|
1373
|
+
|
1374
|
+
|
1375
|
+
--
|
1376
|
+
-- Name: skr_so_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1377
|
+
--
|
1378
|
+
|
1379
|
+
ALTER SEQUENCE skr_so_lines_id_seq OWNED BY skr_so_lines.id;
|
1380
|
+
|
1381
|
+
|
1382
|
+
--
|
1383
|
+
-- Name: skr_uoms_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1384
|
+
--
|
1385
|
+
|
1386
|
+
CREATE SEQUENCE skr_uoms_id_seq
|
1387
|
+
START WITH 1
|
1388
|
+
INCREMENT BY 1
|
1389
|
+
NO MINVALUE
|
1390
|
+
NO MAXVALUE
|
1391
|
+
CACHE 1;
|
1392
|
+
|
1393
|
+
|
1394
|
+
--
|
1395
|
+
-- Name: skr_uoms_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1396
|
+
--
|
1397
|
+
|
1398
|
+
ALTER SEQUENCE skr_uoms_id_seq OWNED BY skr_uoms.id;
|
1399
|
+
|
1400
|
+
|
1401
|
+
--
|
1402
|
+
-- Name: skr_vendors_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1403
|
+
--
|
1404
|
+
|
1405
|
+
CREATE SEQUENCE skr_vendors_id_seq
|
1406
|
+
START WITH 1
|
1407
|
+
INCREMENT BY 1
|
1408
|
+
NO MINVALUE
|
1409
|
+
NO MAXVALUE
|
1410
|
+
CACHE 1;
|
1411
|
+
|
1412
|
+
|
1413
|
+
--
|
1414
|
+
-- Name: skr_vendors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1415
|
+
--
|
1416
|
+
|
1417
|
+
ALTER SEQUENCE skr_vendors_id_seq OWNED BY skr_vendors.id;
|
1418
|
+
|
1419
|
+
|
1420
|
+
--
|
1421
|
+
-- Name: skr_vo_lines; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1422
|
+
--
|
1423
|
+
|
1424
|
+
CREATE TABLE skr_vo_lines (
|
1425
|
+
id integer NOT NULL,
|
1426
|
+
voucher_id integer NOT NULL,
|
1427
|
+
sku_vendor_id integer NOT NULL,
|
1428
|
+
po_line_id integer,
|
1429
|
+
sku_code character varying NOT NULL,
|
1430
|
+
part_code character varying NOT NULL,
|
1431
|
+
description character varying NOT NULL,
|
1432
|
+
uom_code character varying NOT NULL,
|
1433
|
+
uom_size smallint NOT NULL,
|
1434
|
+
"position" smallint NOT NULL,
|
1435
|
+
qty integer DEFAULT 0 NOT NULL,
|
1436
|
+
price numeric(15,2) NOT NULL,
|
1437
|
+
created_at timestamp without time zone NOT NULL,
|
1438
|
+
created_by_id integer NOT NULL,
|
1439
|
+
updated_at timestamp without time zone NOT NULL,
|
1440
|
+
updated_by_id integer NOT NULL
|
1441
|
+
);
|
1442
|
+
|
1443
|
+
|
1444
|
+
--
|
1445
|
+
-- Name: skr_vo_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1446
|
+
--
|
1447
|
+
|
1448
|
+
CREATE SEQUENCE skr_vo_lines_id_seq
|
1449
|
+
START WITH 1
|
1450
|
+
INCREMENT BY 1
|
1451
|
+
NO MINVALUE
|
1452
|
+
NO MAXVALUE
|
1453
|
+
CACHE 1;
|
1454
|
+
|
1455
|
+
|
1456
|
+
--
|
1457
|
+
-- Name: skr_vo_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1458
|
+
--
|
1459
|
+
|
1460
|
+
ALTER SEQUENCE skr_vo_lines_id_seq OWNED BY skr_vo_lines.id;
|
1461
|
+
|
1462
|
+
|
1463
|
+
--
|
1464
|
+
-- Name: skr_vouchers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1465
|
+
--
|
1466
|
+
|
1467
|
+
CREATE TABLE skr_vouchers (
|
1468
|
+
id integer NOT NULL,
|
1469
|
+
visible_id integer NOT NULL,
|
1470
|
+
vendor_id integer NOT NULL,
|
1471
|
+
purchase_order_id integer,
|
1472
|
+
terms_id integer NOT NULL,
|
1473
|
+
state character varying NOT NULL,
|
1474
|
+
refno character varying,
|
1475
|
+
confirmation_date date,
|
1476
|
+
created_at timestamp without time zone NOT NULL,
|
1477
|
+
created_by_id integer NOT NULL,
|
1478
|
+
updated_at timestamp without time zone NOT NULL,
|
1479
|
+
updated_by_id integer NOT NULL
|
1480
|
+
);
|
1481
|
+
|
1482
|
+
|
1483
|
+
--
|
1484
|
+
-- Name: skr_vouchers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1485
|
+
--
|
1486
|
+
|
1487
|
+
CREATE SEQUENCE skr_vouchers_id_seq
|
1488
|
+
START WITH 1
|
1489
|
+
INCREMENT BY 1
|
1490
|
+
NO MINVALUE
|
1491
|
+
NO MAXVALUE
|
1492
|
+
CACHE 1;
|
1493
|
+
|
1494
|
+
|
1495
|
+
--
|
1496
|
+
-- Name: skr_vouchers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1497
|
+
--
|
1498
|
+
|
1499
|
+
ALTER SEQUENCE skr_vouchers_id_seq OWNED BY skr_vouchers.id;
|
1500
|
+
|
1501
|
+
|
1502
|
+
--
|
1503
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1504
|
+
--
|
1505
|
+
|
1506
|
+
ALTER TABLE ONLY lanes_users ALTER COLUMN id SET DEFAULT nextval('lanes_users_id_seq'::regclass);
|
1507
|
+
|
1508
|
+
|
1509
|
+
--
|
1510
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1511
|
+
--
|
1512
|
+
|
1513
|
+
ALTER TABLE ONLY skr_addresses ALTER COLUMN id SET DEFAULT nextval('skr_addresses_id_seq'::regclass);
|
1514
|
+
|
1515
|
+
|
1516
|
+
--
|
1517
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1518
|
+
--
|
1519
|
+
|
1520
|
+
ALTER TABLE ONLY skr_customers ALTER COLUMN id SET DEFAULT nextval('skr_customers_id_seq'::regclass);
|
1521
|
+
|
1522
|
+
|
1523
|
+
--
|
1524
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1525
|
+
--
|
1526
|
+
|
1527
|
+
ALTER TABLE ONLY skr_gl_accounts ALTER COLUMN id SET DEFAULT nextval('skr_gl_accounts_id_seq'::regclass);
|
1528
|
+
|
1529
|
+
|
1530
|
+
--
|
1531
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1532
|
+
--
|
1533
|
+
|
1534
|
+
ALTER TABLE ONLY skr_gl_manual_entries ALTER COLUMN id SET DEFAULT nextval('skr_gl_manual_entries_id_seq'::regclass);
|
1535
|
+
|
1536
|
+
|
1537
|
+
--
|
1538
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1539
|
+
--
|
1540
|
+
|
1541
|
+
ALTER TABLE ONLY skr_gl_periods ALTER COLUMN id SET DEFAULT nextval('skr_gl_periods_id_seq'::regclass);
|
1542
|
+
|
1543
|
+
|
1544
|
+
--
|
1545
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1546
|
+
--
|
1547
|
+
|
1548
|
+
ALTER TABLE ONLY skr_gl_postings ALTER COLUMN id SET DEFAULT nextval('skr_gl_postings_id_seq'::regclass);
|
1549
|
+
|
1550
|
+
|
1551
|
+
--
|
1552
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1553
|
+
--
|
1554
|
+
|
1555
|
+
ALTER TABLE ONLY skr_gl_transactions ALTER COLUMN id SET DEFAULT nextval('skr_gl_transactions_id_seq'::regclass);
|
1556
|
+
|
1557
|
+
|
1558
|
+
--
|
1559
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1560
|
+
--
|
1561
|
+
|
1562
|
+
ALTER TABLE ONLY skr_ia_lines ALTER COLUMN id SET DEFAULT nextval('skr_ia_lines_id_seq'::regclass);
|
1563
|
+
|
1564
|
+
|
1565
|
+
--
|
1566
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1567
|
+
--
|
1568
|
+
|
1569
|
+
ALTER TABLE ONLY skr_ia_reasons ALTER COLUMN id SET DEFAULT nextval('skr_ia_reasons_id_seq'::regclass);
|
1570
|
+
|
1571
|
+
|
1572
|
+
--
|
1573
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1574
|
+
--
|
1575
|
+
|
1576
|
+
ALTER TABLE ONLY skr_inv_lines ALTER COLUMN id SET DEFAULT nextval('skr_inv_lines_id_seq'::regclass);
|
1577
|
+
|
1578
|
+
|
1579
|
+
--
|
1580
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1581
|
+
--
|
1582
|
+
|
1583
|
+
ALTER TABLE ONLY skr_inventory_adjustments ALTER COLUMN id SET DEFAULT nextval('skr_inventory_adjustments_id_seq'::regclass);
|
1584
|
+
|
1585
|
+
|
1586
|
+
--
|
1587
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1588
|
+
--
|
1589
|
+
|
1590
|
+
ALTER TABLE ONLY skr_invoices ALTER COLUMN id SET DEFAULT nextval('skr_invoices_id_seq'::regclass);
|
1591
|
+
|
1592
|
+
|
1593
|
+
--
|
1594
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1595
|
+
--
|
1596
|
+
|
1597
|
+
ALTER TABLE ONLY skr_locations ALTER COLUMN id SET DEFAULT nextval('skr_locations_id_seq'::regclass);
|
1598
|
+
|
1599
|
+
|
1600
|
+
--
|
1601
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1602
|
+
--
|
1603
|
+
|
1604
|
+
ALTER TABLE ONLY skr_payment_terms ALTER COLUMN id SET DEFAULT nextval('skr_payment_terms_id_seq'::regclass);
|
1605
|
+
|
1606
|
+
|
1607
|
+
--
|
1608
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1609
|
+
--
|
1610
|
+
|
1611
|
+
ALTER TABLE ONLY skr_pick_tickets ALTER COLUMN id SET DEFAULT nextval('skr_pick_tickets_id_seq'::regclass);
|
1612
|
+
|
1613
|
+
|
1614
|
+
--
|
1615
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1616
|
+
--
|
1617
|
+
|
1618
|
+
ALTER TABLE ONLY skr_po_lines ALTER COLUMN id SET DEFAULT nextval('skr_po_lines_id_seq'::regclass);
|
1619
|
+
|
1620
|
+
|
1621
|
+
--
|
1622
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1623
|
+
--
|
1624
|
+
|
1625
|
+
ALTER TABLE ONLY skr_po_receipts ALTER COLUMN id SET DEFAULT nextval('skr_po_receipts_id_seq'::regclass);
|
1626
|
+
|
1627
|
+
|
1628
|
+
--
|
1629
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1630
|
+
--
|
1631
|
+
|
1632
|
+
ALTER TABLE ONLY skr_por_lines ALTER COLUMN id SET DEFAULT nextval('skr_por_lines_id_seq'::regclass);
|
1633
|
+
|
1634
|
+
|
1635
|
+
--
|
1636
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1637
|
+
--
|
1638
|
+
|
1639
|
+
ALTER TABLE ONLY skr_pt_lines ALTER COLUMN id SET DEFAULT nextval('skr_pt_lines_id_seq'::regclass);
|
1640
|
+
|
1641
|
+
|
1642
|
+
--
|
1643
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1644
|
+
--
|
1645
|
+
|
1646
|
+
ALTER TABLE ONLY skr_purchase_orders ALTER COLUMN id SET DEFAULT nextval('skr_purchase_orders_id_seq'::regclass);
|
1647
|
+
|
1648
|
+
|
1649
|
+
--
|
1650
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1651
|
+
--
|
1652
|
+
|
1653
|
+
ALTER TABLE ONLY skr_sales_orders ALTER COLUMN id SET DEFAULT nextval('skr_sales_orders_id_seq'::regclass);
|
1654
|
+
|
1655
|
+
|
1656
|
+
--
|
1657
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1658
|
+
--
|
1659
|
+
|
1660
|
+
ALTER TABLE ONLY skr_sku_locs ALTER COLUMN id SET DEFAULT nextval('skr_sku_locs_id_seq'::regclass);
|
1661
|
+
|
1662
|
+
|
1663
|
+
--
|
1664
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1665
|
+
--
|
1666
|
+
|
1667
|
+
ALTER TABLE ONLY skr_sku_trans ALTER COLUMN id SET DEFAULT nextval('skr_sku_trans_id_seq'::regclass);
|
1668
|
+
|
1669
|
+
|
1670
|
+
--
|
1671
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1672
|
+
--
|
1673
|
+
|
1674
|
+
ALTER TABLE ONLY skr_sku_vendors ALTER COLUMN id SET DEFAULT nextval('skr_sku_vendors_id_seq'::regclass);
|
1675
|
+
|
1676
|
+
|
1677
|
+
--
|
1678
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1679
|
+
--
|
1680
|
+
|
1681
|
+
ALTER TABLE ONLY skr_skus ALTER COLUMN id SET DEFAULT nextval('skr_skus_id_seq'::regclass);
|
1682
|
+
|
1683
|
+
|
1684
|
+
--
|
1685
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1686
|
+
--
|
1687
|
+
|
1688
|
+
ALTER TABLE ONLY skr_so_lines ALTER COLUMN id SET DEFAULT nextval('skr_so_lines_id_seq'::regclass);
|
1689
|
+
|
1690
|
+
|
1691
|
+
--
|
1692
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1693
|
+
--
|
1694
|
+
|
1695
|
+
ALTER TABLE ONLY skr_uoms ALTER COLUMN id SET DEFAULT nextval('skr_uoms_id_seq'::regclass);
|
1696
|
+
|
1697
|
+
|
1698
|
+
--
|
1699
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1700
|
+
--
|
1701
|
+
|
1702
|
+
ALTER TABLE ONLY skr_vendors ALTER COLUMN id SET DEFAULT nextval('skr_vendors_id_seq'::regclass);
|
1703
|
+
|
1704
|
+
|
1705
|
+
--
|
1706
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1707
|
+
--
|
1708
|
+
|
1709
|
+
ALTER TABLE ONLY skr_vo_lines ALTER COLUMN id SET DEFAULT nextval('skr_vo_lines_id_seq'::regclass);
|
1710
|
+
|
1711
|
+
|
1712
|
+
--
|
1713
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1714
|
+
--
|
1715
|
+
|
1716
|
+
ALTER TABLE ONLY skr_vouchers ALTER COLUMN id SET DEFAULT nextval('skr_vouchers_id_seq'::regclass);
|
1717
|
+
|
1718
|
+
|
1719
|
+
--
|
1720
|
+
-- Name: lanes_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1721
|
+
--
|
1722
|
+
|
1723
|
+
ALTER TABLE ONLY lanes_users
|
1724
|
+
ADD CONSTRAINT lanes_users_pkey PRIMARY KEY (id);
|
1725
|
+
|
1726
|
+
|
1727
|
+
--
|
1728
|
+
-- Name: skr_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1729
|
+
--
|
1730
|
+
|
1731
|
+
ALTER TABLE ONLY skr_addresses
|
1732
|
+
ADD CONSTRAINT skr_addresses_pkey PRIMARY KEY (id);
|
1733
|
+
|
1734
|
+
|
1735
|
+
--
|
1736
|
+
-- Name: skr_customers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1737
|
+
--
|
1738
|
+
|
1739
|
+
ALTER TABLE ONLY skr_customers
|
1740
|
+
ADD CONSTRAINT skr_customers_pkey PRIMARY KEY (id);
|
1741
|
+
|
1742
|
+
|
1743
|
+
--
|
1744
|
+
-- Name: skr_gl_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1745
|
+
--
|
1746
|
+
|
1747
|
+
ALTER TABLE ONLY skr_gl_accounts
|
1748
|
+
ADD CONSTRAINT skr_gl_accounts_pkey PRIMARY KEY (id);
|
1749
|
+
|
1750
|
+
|
1751
|
+
--
|
1752
|
+
-- Name: skr_gl_manual_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1753
|
+
--
|
1754
|
+
|
1755
|
+
ALTER TABLE ONLY skr_gl_manual_entries
|
1756
|
+
ADD CONSTRAINT skr_gl_manual_entries_pkey PRIMARY KEY (id);
|
1757
|
+
|
1758
|
+
|
1759
|
+
--
|
1760
|
+
-- Name: skr_gl_periods_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1761
|
+
--
|
1762
|
+
|
1763
|
+
ALTER TABLE ONLY skr_gl_periods
|
1764
|
+
ADD CONSTRAINT skr_gl_periods_pkey PRIMARY KEY (id);
|
1765
|
+
|
1766
|
+
|
1767
|
+
--
|
1768
|
+
-- Name: skr_gl_postings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1769
|
+
--
|
1770
|
+
|
1771
|
+
ALTER TABLE ONLY skr_gl_postings
|
1772
|
+
ADD CONSTRAINT skr_gl_postings_pkey PRIMARY KEY (id);
|
1773
|
+
|
1774
|
+
|
1775
|
+
--
|
1776
|
+
-- Name: skr_gl_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1777
|
+
--
|
1778
|
+
|
1779
|
+
ALTER TABLE ONLY skr_gl_transactions
|
1780
|
+
ADD CONSTRAINT skr_gl_transactions_pkey PRIMARY KEY (id);
|
1781
|
+
|
1782
|
+
|
1783
|
+
--
|
1784
|
+
-- Name: skr_ia_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1785
|
+
--
|
1786
|
+
|
1787
|
+
ALTER TABLE ONLY skr_ia_lines
|
1788
|
+
ADD CONSTRAINT skr_ia_lines_pkey PRIMARY KEY (id);
|
1789
|
+
|
1790
|
+
|
1791
|
+
--
|
1792
|
+
-- Name: skr_ia_reasons_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1793
|
+
--
|
1794
|
+
|
1795
|
+
ALTER TABLE ONLY skr_ia_reasons
|
1796
|
+
ADD CONSTRAINT skr_ia_reasons_pkey PRIMARY KEY (id);
|
1797
|
+
|
1798
|
+
|
1799
|
+
--
|
1800
|
+
-- Name: skr_inv_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1801
|
+
--
|
1802
|
+
|
1803
|
+
ALTER TABLE ONLY skr_inv_lines
|
1804
|
+
ADD CONSTRAINT skr_inv_lines_pkey PRIMARY KEY (id);
|
1805
|
+
|
1806
|
+
|
1807
|
+
--
|
1808
|
+
-- Name: skr_inventory_adjustments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1809
|
+
--
|
1810
|
+
|
1811
|
+
ALTER TABLE ONLY skr_inventory_adjustments
|
1812
|
+
ADD CONSTRAINT skr_inventory_adjustments_pkey PRIMARY KEY (id);
|
1813
|
+
|
1814
|
+
|
1815
|
+
--
|
1816
|
+
-- Name: skr_invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1817
|
+
--
|
1818
|
+
|
1819
|
+
ALTER TABLE ONLY skr_invoices
|
1820
|
+
ADD CONSTRAINT skr_invoices_pkey PRIMARY KEY (id);
|
1821
|
+
|
1822
|
+
|
1823
|
+
--
|
1824
|
+
-- Name: skr_locations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1825
|
+
--
|
1826
|
+
|
1827
|
+
ALTER TABLE ONLY skr_locations
|
1828
|
+
ADD CONSTRAINT skr_locations_pkey PRIMARY KEY (id);
|
1829
|
+
|
1830
|
+
|
1831
|
+
--
|
1832
|
+
-- Name: skr_payment_terms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1833
|
+
--
|
1834
|
+
|
1835
|
+
ALTER TABLE ONLY skr_payment_terms
|
1836
|
+
ADD CONSTRAINT skr_payment_terms_pkey PRIMARY KEY (id);
|
1837
|
+
|
1838
|
+
|
1839
|
+
--
|
1840
|
+
-- Name: skr_pick_tickets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1841
|
+
--
|
1842
|
+
|
1843
|
+
ALTER TABLE ONLY skr_pick_tickets
|
1844
|
+
ADD CONSTRAINT skr_pick_tickets_pkey PRIMARY KEY (id);
|
1845
|
+
|
1846
|
+
|
1847
|
+
--
|
1848
|
+
-- Name: skr_po_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1849
|
+
--
|
1850
|
+
|
1851
|
+
ALTER TABLE ONLY skr_po_lines
|
1852
|
+
ADD CONSTRAINT skr_po_lines_pkey PRIMARY KEY (id);
|
1853
|
+
|
1854
|
+
|
1855
|
+
--
|
1856
|
+
-- Name: skr_po_receipts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1857
|
+
--
|
1858
|
+
|
1859
|
+
ALTER TABLE ONLY skr_po_receipts
|
1860
|
+
ADD CONSTRAINT skr_po_receipts_pkey PRIMARY KEY (id);
|
1861
|
+
|
1862
|
+
|
1863
|
+
--
|
1864
|
+
-- Name: skr_por_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1865
|
+
--
|
1866
|
+
|
1867
|
+
ALTER TABLE ONLY skr_por_lines
|
1868
|
+
ADD CONSTRAINT skr_por_lines_pkey PRIMARY KEY (id);
|
1869
|
+
|
1870
|
+
|
1871
|
+
--
|
1872
|
+
-- Name: skr_pt_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1873
|
+
--
|
1874
|
+
|
1875
|
+
ALTER TABLE ONLY skr_pt_lines
|
1876
|
+
ADD CONSTRAINT skr_pt_lines_pkey PRIMARY KEY (id);
|
1877
|
+
|
1878
|
+
|
1879
|
+
--
|
1880
|
+
-- Name: skr_purchase_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1881
|
+
--
|
1882
|
+
|
1883
|
+
ALTER TABLE ONLY skr_purchase_orders
|
1884
|
+
ADD CONSTRAINT skr_purchase_orders_pkey PRIMARY KEY (id);
|
1885
|
+
|
1886
|
+
|
1887
|
+
--
|
1888
|
+
-- Name: skr_sales_orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1889
|
+
--
|
1890
|
+
|
1891
|
+
ALTER TABLE ONLY skr_sales_orders
|
1892
|
+
ADD CONSTRAINT skr_sales_orders_pkey PRIMARY KEY (id);
|
1893
|
+
|
1894
|
+
|
1895
|
+
--
|
1896
|
+
-- Name: skr_sequential_ids_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1897
|
+
--
|
1898
|
+
|
1899
|
+
ALTER TABLE ONLY skr_sequential_ids
|
1900
|
+
ADD CONSTRAINT skr_sequential_ids_pkey PRIMARY KEY (name);
|
1901
|
+
|
1902
|
+
|
1903
|
+
--
|
1904
|
+
-- Name: skr_sku_locs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1905
|
+
--
|
1906
|
+
|
1907
|
+
ALTER TABLE ONLY skr_sku_locs
|
1908
|
+
ADD CONSTRAINT skr_sku_locs_pkey PRIMARY KEY (id);
|
1909
|
+
|
1910
|
+
|
1911
|
+
--
|
1912
|
+
-- Name: skr_sku_trans_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1913
|
+
--
|
1914
|
+
|
1915
|
+
ALTER TABLE ONLY skr_sku_trans
|
1916
|
+
ADD CONSTRAINT skr_sku_trans_pkey PRIMARY KEY (id);
|
1917
|
+
|
1918
|
+
|
1919
|
+
--
|
1920
|
+
-- Name: skr_sku_vendors_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1921
|
+
--
|
1922
|
+
|
1923
|
+
ALTER TABLE ONLY skr_sku_vendors
|
1924
|
+
ADD CONSTRAINT skr_sku_vendors_pkey PRIMARY KEY (id);
|
1925
|
+
|
1926
|
+
|
1927
|
+
--
|
1928
|
+
-- Name: skr_skus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1929
|
+
--
|
1930
|
+
|
1931
|
+
ALTER TABLE ONLY skr_skus
|
1932
|
+
ADD CONSTRAINT skr_skus_pkey PRIMARY KEY (id);
|
1933
|
+
|
1934
|
+
|
1935
|
+
--
|
1936
|
+
-- Name: skr_so_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1937
|
+
--
|
1938
|
+
|
1939
|
+
ALTER TABLE ONLY skr_so_lines
|
1940
|
+
ADD CONSTRAINT skr_so_lines_pkey PRIMARY KEY (id);
|
1941
|
+
|
1942
|
+
|
1943
|
+
--
|
1944
|
+
-- Name: skr_uoms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1945
|
+
--
|
1946
|
+
|
1947
|
+
ALTER TABLE ONLY skr_uoms
|
1948
|
+
ADD CONSTRAINT skr_uoms_pkey PRIMARY KEY (id);
|
1949
|
+
|
1950
|
+
|
1951
|
+
--
|
1952
|
+
-- Name: skr_vendors_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1953
|
+
--
|
1954
|
+
|
1955
|
+
ALTER TABLE ONLY skr_vendors
|
1956
|
+
ADD CONSTRAINT skr_vendors_pkey PRIMARY KEY (id);
|
1957
|
+
|
1958
|
+
|
1959
|
+
--
|
1960
|
+
-- Name: skr_vo_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1961
|
+
--
|
1962
|
+
|
1963
|
+
ALTER TABLE ONLY skr_vo_lines
|
1964
|
+
ADD CONSTRAINT skr_vo_lines_pkey PRIMARY KEY (id);
|
1965
|
+
|
1966
|
+
|
1967
|
+
--
|
1968
|
+
-- Name: skr_vouchers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1969
|
+
--
|
1970
|
+
|
1971
|
+
ALTER TABLE ONLY skr_vouchers
|
1972
|
+
ADD CONSTRAINT skr_vouchers_pkey PRIMARY KEY (id);
|
1973
|
+
|
1974
|
+
|
1975
|
+
--
|
1976
|
+
-- Name: index_lanes_users_on_role_names; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
1977
|
+
--
|
1978
|
+
|
1979
|
+
CREATE INDEX index_lanes_users_on_role_names ON lanes_users USING gin (role_names);
|
1980
|
+
|
1981
|
+
|
1982
|
+
--
|
1983
|
+
-- Name: index_skr_customers_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
1984
|
+
--
|
1985
|
+
|
1986
|
+
CREATE INDEX index_skr_customers_on_code ON skr_customers USING btree (code);
|
1987
|
+
|
1988
|
+
|
1989
|
+
--
|
1990
|
+
-- Name: index_skr_gl_postings_on_period_and_year_and_account_number; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
1991
|
+
--
|
1992
|
+
|
1993
|
+
CREATE INDEX index_skr_gl_postings_on_period_and_year_and_account_number ON skr_gl_postings USING btree (period, year, account_number);
|
1994
|
+
|
1995
|
+
|
1996
|
+
--
|
1997
|
+
-- Name: index_skr_locations_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
1998
|
+
--
|
1999
|
+
|
2000
|
+
CREATE INDEX index_skr_locations_on_code ON skr_locations USING btree (code);
|
2001
|
+
|
2002
|
+
|
2003
|
+
--
|
2004
|
+
-- Name: index_skr_payment_terms_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2005
|
+
--
|
2006
|
+
|
2007
|
+
CREATE INDEX index_skr_payment_terms_on_code ON skr_payment_terms USING btree (code);
|
2008
|
+
|
2009
|
+
|
2010
|
+
--
|
2011
|
+
-- Name: skr_gl_manual_entriesindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2012
|
+
--
|
2013
|
+
|
2014
|
+
CREATE INDEX skr_gl_manual_entriesindx_visible_id ON skr_gl_manual_entries USING btree (((visible_id)::character varying));
|
2015
|
+
|
2016
|
+
|
2017
|
+
--
|
2018
|
+
-- Name: skr_inventory_adjustmentsindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2019
|
+
--
|
2020
|
+
|
2021
|
+
CREATE INDEX skr_inventory_adjustmentsindx_visible_id ON skr_inventory_adjustments USING btree (((visible_id)::character varying));
|
2022
|
+
|
2023
|
+
|
2024
|
+
--
|
2025
|
+
-- Name: skr_invoicesindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2026
|
+
--
|
2027
|
+
|
2028
|
+
CREATE INDEX skr_invoicesindx_visible_id ON skr_invoices USING btree (((visible_id)::character varying));
|
2029
|
+
|
2030
|
+
|
2031
|
+
--
|
2032
|
+
-- Name: skr_pick_ticketsindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2033
|
+
--
|
2034
|
+
|
2035
|
+
CREATE INDEX skr_pick_ticketsindx_visible_id ON skr_pick_tickets USING btree (((visible_id)::character varying));
|
2036
|
+
|
2037
|
+
|
2038
|
+
--
|
2039
|
+
-- Name: skr_po_receiptsindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2040
|
+
--
|
2041
|
+
|
2042
|
+
CREATE INDEX skr_po_receiptsindx_visible_id ON skr_po_receipts USING btree (((visible_id)::character varying));
|
2043
|
+
|
2044
|
+
|
2045
|
+
--
|
2046
|
+
-- Name: skr_purchase_ordersindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2047
|
+
--
|
2048
|
+
|
2049
|
+
CREATE INDEX skr_purchase_ordersindx_visible_id ON skr_purchase_orders USING btree (((visible_id)::character varying));
|
2050
|
+
|
2051
|
+
|
2052
|
+
--
|
2053
|
+
-- Name: skr_sales_ordersindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2054
|
+
--
|
2055
|
+
|
2056
|
+
CREATE INDEX skr_sales_ordersindx_visible_id ON skr_sales_orders USING btree (((visible_id)::character varying));
|
2057
|
+
|
2058
|
+
|
2059
|
+
--
|
2060
|
+
-- Name: skr_vouchersindx_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2061
|
+
--
|
2062
|
+
|
2063
|
+
CREATE INDEX skr_vouchersindx_visible_id ON skr_vouchers USING btree (((visible_id)::character varying));
|
2064
|
+
|
2065
|
+
|
2066
|
+
--
|
2067
|
+
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2068
|
+
--
|
2069
|
+
|
2070
|
+
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
|
2071
|
+
|
2072
|
+
|
2073
|
+
--
|
2074
|
+
-- Name: skr_customers_gl_receivables_account_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2075
|
+
--
|
2076
|
+
|
2077
|
+
ALTER TABLE ONLY skr_customers
|
2078
|
+
ADD CONSTRAINT skr_customers_gl_receivables_account_id_fk FOREIGN KEY (gl_receivables_account_id) REFERENCES skr_gl_accounts(id);
|
2079
|
+
|
2080
|
+
|
2081
|
+
--
|
2082
|
+
-- Name: skr_customers_shipping_address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2083
|
+
--
|
2084
|
+
|
2085
|
+
ALTER TABLE ONLY skr_customers
|
2086
|
+
ADD CONSTRAINT skr_customers_shipping_address_id_fk FOREIGN KEY (shipping_address_id) REFERENCES skr_addresses(id);
|
2087
|
+
|
2088
|
+
|
2089
|
+
--
|
2090
|
+
-- Name: skr_customers_terms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2091
|
+
--
|
2092
|
+
|
2093
|
+
ALTER TABLE ONLY skr_customers
|
2094
|
+
ADD CONSTRAINT skr_customers_terms_id_fk FOREIGN KEY (terms_id) REFERENCES skr_payment_terms(id);
|
2095
|
+
|
2096
|
+
|
2097
|
+
--
|
2098
|
+
-- Name: skr_gl_postings_gl_transaction_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2099
|
+
--
|
2100
|
+
|
2101
|
+
ALTER TABLE ONLY skr_gl_postings
|
2102
|
+
ADD CONSTRAINT skr_gl_postings_gl_transaction_id_fk FOREIGN KEY (gl_transaction_id) REFERENCES skr_gl_transactions(id);
|
2103
|
+
|
2104
|
+
|
2105
|
+
--
|
2106
|
+
-- Name: skr_gl_transactions_period_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2107
|
+
--
|
2108
|
+
|
2109
|
+
ALTER TABLE ONLY skr_gl_transactions
|
2110
|
+
ADD CONSTRAINT skr_gl_transactions_period_id_fk FOREIGN KEY (period_id) REFERENCES skr_gl_periods(id);
|
2111
|
+
|
2112
|
+
|
2113
|
+
--
|
2114
|
+
-- Name: skr_ia_lines_inventory_adjustment_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2115
|
+
--
|
2116
|
+
|
2117
|
+
ALTER TABLE ONLY skr_ia_lines
|
2118
|
+
ADD CONSTRAINT skr_ia_lines_inventory_adjustment_id_fk FOREIGN KEY (inventory_adjustment_id) REFERENCES skr_inventory_adjustments(id);
|
2119
|
+
|
2120
|
+
|
2121
|
+
--
|
2122
|
+
-- Name: skr_ia_lines_sku_loc_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2123
|
+
--
|
2124
|
+
|
2125
|
+
ALTER TABLE ONLY skr_ia_lines
|
2126
|
+
ADD CONSTRAINT skr_ia_lines_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2127
|
+
|
2128
|
+
|
2129
|
+
--
|
2130
|
+
-- Name: skr_ia_reasons_gl_account_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2131
|
+
--
|
2132
|
+
|
2133
|
+
ALTER TABLE ONLY skr_ia_reasons
|
2134
|
+
ADD CONSTRAINT skr_ia_reasons_gl_account_id_fk FOREIGN KEY (gl_account_id) REFERENCES skr_gl_accounts(id);
|
2135
|
+
|
2136
|
+
|
2137
|
+
--
|
2138
|
+
-- Name: skr_inv_lines_invoice_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2139
|
+
--
|
2140
|
+
|
2141
|
+
ALTER TABLE ONLY skr_inv_lines
|
2142
|
+
ADD CONSTRAINT skr_inv_lines_invoice_id_fk FOREIGN KEY (invoice_id) REFERENCES skr_invoices(id);
|
2143
|
+
|
2144
|
+
|
2145
|
+
--
|
2146
|
+
-- Name: skr_inv_lines_pt_line_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2147
|
+
--
|
2148
|
+
|
2149
|
+
ALTER TABLE ONLY skr_inv_lines
|
2150
|
+
ADD CONSTRAINT skr_inv_lines_pt_line_id_fk FOREIGN KEY (pt_line_id) REFERENCES skr_pt_lines(id);
|
2151
|
+
|
2152
|
+
|
2153
|
+
--
|
2154
|
+
-- Name: skr_inv_lines_sku_loc_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2155
|
+
--
|
2156
|
+
|
2157
|
+
ALTER TABLE ONLY skr_inv_lines
|
2158
|
+
ADD CONSTRAINT skr_inv_lines_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2159
|
+
|
2160
|
+
|
2161
|
+
--
|
2162
|
+
-- Name: skr_inv_lines_so_line_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2163
|
+
--
|
2164
|
+
|
2165
|
+
ALTER TABLE ONLY skr_inv_lines
|
2166
|
+
ADD CONSTRAINT skr_inv_lines_so_line_id_fk FOREIGN KEY (so_line_id) REFERENCES skr_so_lines(id);
|
2167
|
+
|
2168
|
+
|
2169
|
+
--
|
2170
|
+
-- Name: skr_inventory_adjustments_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2171
|
+
--
|
2172
|
+
|
2173
|
+
ALTER TABLE ONLY skr_inventory_adjustments
|
2174
|
+
ADD CONSTRAINT skr_inventory_adjustments_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2175
|
+
|
2176
|
+
|
2177
|
+
--
|
2178
|
+
-- Name: skr_inventory_adjustments_reason_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2179
|
+
--
|
2180
|
+
|
2181
|
+
ALTER TABLE ONLY skr_inventory_adjustments
|
2182
|
+
ADD CONSTRAINT skr_inventory_adjustments_reason_id_fk FOREIGN KEY (reason_id) REFERENCES skr_ia_reasons(id);
|
2183
|
+
|
2184
|
+
|
2185
|
+
--
|
2186
|
+
-- Name: skr_invoices_billing_address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2187
|
+
--
|
2188
|
+
|
2189
|
+
ALTER TABLE ONLY skr_invoices
|
2190
|
+
ADD CONSTRAINT skr_invoices_billing_address_id_fk FOREIGN KEY (billing_address_id) REFERENCES skr_addresses(id);
|
2191
|
+
|
2192
|
+
|
2193
|
+
--
|
2194
|
+
-- Name: skr_invoices_customer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2195
|
+
--
|
2196
|
+
|
2197
|
+
ALTER TABLE ONLY skr_invoices
|
2198
|
+
ADD CONSTRAINT skr_invoices_customer_id_fk FOREIGN KEY (customer_id) REFERENCES skr_customers(id);
|
2199
|
+
|
2200
|
+
|
2201
|
+
--
|
2202
|
+
-- Name: skr_invoices_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2203
|
+
--
|
2204
|
+
|
2205
|
+
ALTER TABLE ONLY skr_invoices
|
2206
|
+
ADD CONSTRAINT skr_invoices_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2207
|
+
|
2208
|
+
|
2209
|
+
--
|
2210
|
+
-- Name: skr_invoices_pick_ticket_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2211
|
+
--
|
2212
|
+
|
2213
|
+
ALTER TABLE ONLY skr_invoices
|
2214
|
+
ADD CONSTRAINT skr_invoices_pick_ticket_id_fk FOREIGN KEY (pick_ticket_id) REFERENCES skr_pick_tickets(id);
|
2215
|
+
|
2216
|
+
|
2217
|
+
--
|
2218
|
+
-- Name: skr_invoices_sales_order_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2219
|
+
--
|
2220
|
+
|
2221
|
+
ALTER TABLE ONLY skr_invoices
|
2222
|
+
ADD CONSTRAINT skr_invoices_sales_order_id_fk FOREIGN KEY (sales_order_id) REFERENCES skr_sales_orders(id);
|
2223
|
+
|
2224
|
+
|
2225
|
+
--
|
2226
|
+
-- Name: skr_invoices_terms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2227
|
+
--
|
2228
|
+
|
2229
|
+
ALTER TABLE ONLY skr_invoices
|
2230
|
+
ADD CONSTRAINT skr_invoices_terms_id_fk FOREIGN KEY (terms_id) REFERENCES skr_payment_terms(id);
|
2231
|
+
|
2232
|
+
|
2233
|
+
--
|
2234
|
+
-- Name: skr_locations_address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2235
|
+
--
|
2236
|
+
|
2237
|
+
ALTER TABLE ONLY skr_locations
|
2238
|
+
ADD CONSTRAINT skr_locations_address_id_fk FOREIGN KEY (address_id) REFERENCES skr_addresses(id);
|
2239
|
+
|
2240
|
+
|
2241
|
+
--
|
2242
|
+
-- Name: skr_pick_tickets_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2243
|
+
--
|
2244
|
+
|
2245
|
+
ALTER TABLE ONLY skr_pick_tickets
|
2246
|
+
ADD CONSTRAINT skr_pick_tickets_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2247
|
+
|
2248
|
+
|
2249
|
+
--
|
2250
|
+
-- Name: skr_pick_tickets_sales_order_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2251
|
+
--
|
2252
|
+
|
2253
|
+
ALTER TABLE ONLY skr_pick_tickets
|
2254
|
+
ADD CONSTRAINT skr_pick_tickets_sales_order_id_fk FOREIGN KEY (sales_order_id) REFERENCES skr_sales_orders(id);
|
2255
|
+
|
2256
|
+
|
2257
|
+
--
|
2258
|
+
-- Name: skr_po_lines_purchase_order_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2259
|
+
--
|
2260
|
+
|
2261
|
+
ALTER TABLE ONLY skr_po_lines
|
2262
|
+
ADD CONSTRAINT skr_po_lines_purchase_order_id_fk FOREIGN KEY (purchase_order_id) REFERENCES skr_purchase_orders(id);
|
2263
|
+
|
2264
|
+
|
2265
|
+
--
|
2266
|
+
-- Name: skr_po_lines_sku_loc_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2267
|
+
--
|
2268
|
+
|
2269
|
+
ALTER TABLE ONLY skr_po_lines
|
2270
|
+
ADD CONSTRAINT skr_po_lines_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2271
|
+
|
2272
|
+
|
2273
|
+
--
|
2274
|
+
-- Name: skr_po_lines_sku_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2275
|
+
--
|
2276
|
+
|
2277
|
+
ALTER TABLE ONLY skr_po_lines
|
2278
|
+
ADD CONSTRAINT skr_po_lines_sku_vendor_id_fk FOREIGN KEY (sku_vendor_id) REFERENCES skr_sku_vendors(id);
|
2279
|
+
|
2280
|
+
|
2281
|
+
--
|
2282
|
+
-- Name: skr_po_receipts_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2283
|
+
--
|
2284
|
+
|
2285
|
+
ALTER TABLE ONLY skr_po_receipts
|
2286
|
+
ADD CONSTRAINT skr_po_receipts_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2287
|
+
|
2288
|
+
|
2289
|
+
--
|
2290
|
+
-- Name: skr_po_receipts_purchase_order_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2291
|
+
--
|
2292
|
+
|
2293
|
+
ALTER TABLE ONLY skr_po_receipts
|
2294
|
+
ADD CONSTRAINT skr_po_receipts_purchase_order_id_fk FOREIGN KEY (purchase_order_id) REFERENCES skr_purchase_orders(id);
|
2295
|
+
|
2296
|
+
|
2297
|
+
--
|
2298
|
+
-- Name: skr_po_receipts_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2299
|
+
--
|
2300
|
+
|
2301
|
+
ALTER TABLE ONLY skr_po_receipts
|
2302
|
+
ADD CONSTRAINT skr_po_receipts_vendor_id_fk FOREIGN KEY (vendor_id) REFERENCES skr_vendors(id);
|
2303
|
+
|
2304
|
+
|
2305
|
+
--
|
2306
|
+
-- Name: skr_po_receipts_voucher_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2307
|
+
--
|
2308
|
+
|
2309
|
+
ALTER TABLE ONLY skr_po_receipts
|
2310
|
+
ADD CONSTRAINT skr_po_receipts_voucher_id_fk FOREIGN KEY (voucher_id) REFERENCES skr_vouchers(id);
|
2311
|
+
|
2312
|
+
|
2313
|
+
--
|
2314
|
+
-- Name: skr_por_lines_po_line_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2315
|
+
--
|
2316
|
+
|
2317
|
+
ALTER TABLE ONLY skr_por_lines
|
2318
|
+
ADD CONSTRAINT skr_por_lines_po_line_id_fk FOREIGN KEY (po_line_id) REFERENCES skr_po_lines(id);
|
2319
|
+
|
2320
|
+
|
2321
|
+
--
|
2322
|
+
-- Name: skr_por_lines_po_receipt_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2323
|
+
--
|
2324
|
+
|
2325
|
+
ALTER TABLE ONLY skr_por_lines
|
2326
|
+
ADD CONSTRAINT skr_por_lines_po_receipt_id_fk FOREIGN KEY (po_receipt_id) REFERENCES skr_po_receipts(id);
|
2327
|
+
|
2328
|
+
|
2329
|
+
--
|
2330
|
+
-- Name: skr_por_lines_sku_loc_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2331
|
+
--
|
2332
|
+
|
2333
|
+
ALTER TABLE ONLY skr_por_lines
|
2334
|
+
ADD CONSTRAINT skr_por_lines_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2335
|
+
|
2336
|
+
|
2337
|
+
--
|
2338
|
+
-- Name: skr_por_lines_sku_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2339
|
+
--
|
2340
|
+
|
2341
|
+
ALTER TABLE ONLY skr_por_lines
|
2342
|
+
ADD CONSTRAINT skr_por_lines_sku_vendor_id_fk FOREIGN KEY (sku_vendor_id) REFERENCES skr_sku_vendors(id);
|
2343
|
+
|
2344
|
+
|
2345
|
+
--
|
2346
|
+
-- Name: skr_pt_lines_pick_ticket_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2347
|
+
--
|
2348
|
+
|
2349
|
+
ALTER TABLE ONLY skr_pt_lines
|
2350
|
+
ADD CONSTRAINT skr_pt_lines_pick_ticket_id_fk FOREIGN KEY (pick_ticket_id) REFERENCES skr_pick_tickets(id);
|
2351
|
+
|
2352
|
+
|
2353
|
+
--
|
2354
|
+
-- Name: skr_pt_lines_sku_loc_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2355
|
+
--
|
2356
|
+
|
2357
|
+
ALTER TABLE ONLY skr_pt_lines
|
2358
|
+
ADD CONSTRAINT skr_pt_lines_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2359
|
+
|
2360
|
+
|
2361
|
+
--
|
2362
|
+
-- Name: skr_pt_lines_so_line_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2363
|
+
--
|
2364
|
+
|
2365
|
+
ALTER TABLE ONLY skr_pt_lines
|
2366
|
+
ADD CONSTRAINT skr_pt_lines_so_line_id_fk FOREIGN KEY (so_line_id) REFERENCES skr_so_lines(id);
|
2367
|
+
|
2368
|
+
|
2369
|
+
--
|
2370
|
+
-- Name: skr_purchase_orders_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2371
|
+
--
|
2372
|
+
|
2373
|
+
ALTER TABLE ONLY skr_purchase_orders
|
2374
|
+
ADD CONSTRAINT skr_purchase_orders_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2375
|
+
|
2376
|
+
|
2377
|
+
--
|
2378
|
+
-- Name: skr_purchase_orders_ship_addr_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2379
|
+
--
|
2380
|
+
|
2381
|
+
ALTER TABLE ONLY skr_purchase_orders
|
2382
|
+
ADD CONSTRAINT skr_purchase_orders_ship_addr_id_fk FOREIGN KEY (ship_addr_id) REFERENCES skr_addresses(id);
|
2383
|
+
|
2384
|
+
|
2385
|
+
--
|
2386
|
+
-- Name: skr_purchase_orders_terms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2387
|
+
--
|
2388
|
+
|
2389
|
+
ALTER TABLE ONLY skr_purchase_orders
|
2390
|
+
ADD CONSTRAINT skr_purchase_orders_terms_id_fk FOREIGN KEY (terms_id) REFERENCES skr_payment_terms(id);
|
2391
|
+
|
2392
|
+
|
2393
|
+
--
|
2394
|
+
-- Name: skr_purchase_orders_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2395
|
+
--
|
2396
|
+
|
2397
|
+
ALTER TABLE ONLY skr_purchase_orders
|
2398
|
+
ADD CONSTRAINT skr_purchase_orders_vendor_id_fk FOREIGN KEY (vendor_id) REFERENCES skr_vendors(id);
|
2399
|
+
|
2400
|
+
|
2401
|
+
--
|
2402
|
+
-- Name: skr_sales_orders_billing_address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2403
|
+
--
|
2404
|
+
|
2405
|
+
ALTER TABLE ONLY skr_sales_orders
|
2406
|
+
ADD CONSTRAINT skr_sales_orders_billing_address_id_fk FOREIGN KEY (billing_address_id) REFERENCES skr_addresses(id);
|
2407
|
+
|
2408
|
+
|
2409
|
+
--
|
2410
|
+
-- Name: skr_sales_orders_customer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2411
|
+
--
|
2412
|
+
|
2413
|
+
ALTER TABLE ONLY skr_sales_orders
|
2414
|
+
ADD CONSTRAINT skr_sales_orders_customer_id_fk FOREIGN KEY (customer_id) REFERENCES skr_customers(id);
|
2415
|
+
|
2416
|
+
|
2417
|
+
--
|
2418
|
+
-- Name: skr_sales_orders_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2419
|
+
--
|
2420
|
+
|
2421
|
+
ALTER TABLE ONLY skr_sales_orders
|
2422
|
+
ADD CONSTRAINT skr_sales_orders_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2423
|
+
|
2424
|
+
|
2425
|
+
--
|
2426
|
+
-- Name: skr_sales_orders_terms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2427
|
+
--
|
2428
|
+
|
2429
|
+
ALTER TABLE ONLY skr_sales_orders
|
2430
|
+
ADD CONSTRAINT skr_sales_orders_terms_id_fk FOREIGN KEY (terms_id) REFERENCES skr_payment_terms(id);
|
2431
|
+
|
2432
|
+
|
2433
|
+
--
|
2434
|
+
-- Name: skr_sku_locs_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2435
|
+
--
|
2436
|
+
|
2437
|
+
ALTER TABLE ONLY skr_sku_locs
|
2438
|
+
ADD CONSTRAINT skr_sku_locs_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2439
|
+
|
2440
|
+
|
2441
|
+
--
|
2442
|
+
-- Name: skr_sku_locs_sku_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2443
|
+
--
|
2444
|
+
|
2445
|
+
ALTER TABLE ONLY skr_sku_locs
|
2446
|
+
ADD CONSTRAINT skr_sku_locs_sku_id_fk FOREIGN KEY (sku_id) REFERENCES skr_skus(id);
|
2447
|
+
|
2448
|
+
|
2449
|
+
--
|
2450
|
+
-- Name: skr_sku_trans_sku_loc_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2451
|
+
--
|
2452
|
+
|
2453
|
+
ALTER TABLE ONLY skr_sku_trans
|
2454
|
+
ADD CONSTRAINT skr_sku_trans_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2455
|
+
|
2456
|
+
|
2457
|
+
--
|
2458
|
+
-- Name: skr_sku_vendors_sku_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2459
|
+
--
|
2460
|
+
|
2461
|
+
ALTER TABLE ONLY skr_sku_vendors
|
2462
|
+
ADD CONSTRAINT skr_sku_vendors_sku_id_fk FOREIGN KEY (sku_id) REFERENCES skr_skus(id);
|
2463
|
+
|
2464
|
+
|
2465
|
+
--
|
2466
|
+
-- Name: skr_sku_vendors_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2467
|
+
--
|
2468
|
+
|
2469
|
+
ALTER TABLE ONLY skr_sku_vendors
|
2470
|
+
ADD CONSTRAINT skr_sku_vendors_vendor_id_fk FOREIGN KEY (vendor_id) REFERENCES skr_vendors(id);
|
2471
|
+
|
2472
|
+
|
2473
|
+
--
|
2474
|
+
-- Name: skr_skus_default_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2475
|
+
--
|
2476
|
+
|
2477
|
+
ALTER TABLE ONLY skr_skus
|
2478
|
+
ADD CONSTRAINT skr_skus_default_vendor_id_fk FOREIGN KEY (default_vendor_id) REFERENCES skr_vendors(id);
|
2479
|
+
|
2480
|
+
|
2481
|
+
--
|
2482
|
+
-- Name: skr_skus_gl_asset_account_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2483
|
+
--
|
2484
|
+
|
2485
|
+
ALTER TABLE ONLY skr_skus
|
2486
|
+
ADD CONSTRAINT skr_skus_gl_asset_account_id_fk FOREIGN KEY (gl_asset_account_id) REFERENCES skr_gl_accounts(id);
|
2487
|
+
|
2488
|
+
|
2489
|
+
--
|
2490
|
+
-- Name: skr_so_lines_sales_order_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2491
|
+
--
|
2492
|
+
|
2493
|
+
ALTER TABLE ONLY skr_so_lines
|
2494
|
+
ADD CONSTRAINT skr_so_lines_sales_order_id_fk FOREIGN KEY (sales_order_id) REFERENCES skr_sales_orders(id);
|
2495
|
+
|
2496
|
+
|
2497
|
+
--
|
2498
|
+
-- Name: skr_so_lines_sku_loc_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2499
|
+
--
|
2500
|
+
|
2501
|
+
ALTER TABLE ONLY skr_so_lines
|
2502
|
+
ADD CONSTRAINT skr_so_lines_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2503
|
+
|
2504
|
+
|
2505
|
+
--
|
2506
|
+
-- Name: skr_uoms_sku_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2507
|
+
--
|
2508
|
+
|
2509
|
+
ALTER TABLE ONLY skr_uoms
|
2510
|
+
ADD CONSTRAINT skr_uoms_sku_id_fk FOREIGN KEY (sku_id) REFERENCES skr_skus(id);
|
2511
|
+
|
2512
|
+
|
2513
|
+
--
|
2514
|
+
-- Name: skr_vendors_gl_freight_account_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2515
|
+
--
|
2516
|
+
|
2517
|
+
ALTER TABLE ONLY skr_vendors
|
2518
|
+
ADD CONSTRAINT skr_vendors_gl_freight_account_id_fk FOREIGN KEY (gl_freight_account_id) REFERENCES skr_gl_accounts(id);
|
2519
|
+
|
2520
|
+
|
2521
|
+
--
|
2522
|
+
-- Name: skr_vendors_shipping_address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2523
|
+
--
|
2524
|
+
|
2525
|
+
ALTER TABLE ONLY skr_vendors
|
2526
|
+
ADD CONSTRAINT skr_vendors_shipping_address_id_fk FOREIGN KEY (shipping_address_id) REFERENCES skr_addresses(id);
|
2527
|
+
|
2528
|
+
|
2529
|
+
--
|
2530
|
+
-- Name: skr_vendors_terms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2531
|
+
--
|
2532
|
+
|
2533
|
+
ALTER TABLE ONLY skr_vendors
|
2534
|
+
ADD CONSTRAINT skr_vendors_terms_id_fk FOREIGN KEY (terms_id) REFERENCES skr_payment_terms(id);
|
2535
|
+
|
2536
|
+
|
2537
|
+
--
|
2538
|
+
-- Name: skr_vo_lines_po_line_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2539
|
+
--
|
2540
|
+
|
2541
|
+
ALTER TABLE ONLY skr_vo_lines
|
2542
|
+
ADD CONSTRAINT skr_vo_lines_po_line_id_fk FOREIGN KEY (po_line_id) REFERENCES skr_po_lines(id);
|
2543
|
+
|
2544
|
+
|
2545
|
+
--
|
2546
|
+
-- Name: skr_vo_lines_sku_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2547
|
+
--
|
2548
|
+
|
2549
|
+
ALTER TABLE ONLY skr_vo_lines
|
2550
|
+
ADD CONSTRAINT skr_vo_lines_sku_vendor_id_fk FOREIGN KEY (sku_vendor_id) REFERENCES skr_sku_vendors(id);
|
2551
|
+
|
2552
|
+
|
2553
|
+
--
|
2554
|
+
-- Name: skr_vo_lines_voucher_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2555
|
+
--
|
2556
|
+
|
2557
|
+
ALTER TABLE ONLY skr_vo_lines
|
2558
|
+
ADD CONSTRAINT skr_vo_lines_voucher_id_fk FOREIGN KEY (voucher_id) REFERENCES skr_vouchers(id);
|
2559
|
+
|
2560
|
+
|
2561
|
+
--
|
2562
|
+
-- Name: skr_vouchers_purchase_order_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2563
|
+
--
|
2564
|
+
|
2565
|
+
ALTER TABLE ONLY skr_vouchers
|
2566
|
+
ADD CONSTRAINT skr_vouchers_purchase_order_id_fk FOREIGN KEY (purchase_order_id) REFERENCES skr_purchase_orders(id);
|
2567
|
+
|
2568
|
+
|
2569
|
+
--
|
2570
|
+
-- Name: skr_vouchers_terms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2571
|
+
--
|
2572
|
+
|
2573
|
+
ALTER TABLE ONLY skr_vouchers
|
2574
|
+
ADD CONSTRAINT skr_vouchers_terms_id_fk FOREIGN KEY (terms_id) REFERENCES skr_payment_terms(id);
|
2575
|
+
|
2576
|
+
|
2577
|
+
--
|
2578
|
+
-- Name: skr_vouchers_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2579
|
+
--
|
2580
|
+
|
2581
|
+
ALTER TABLE ONLY skr_vouchers
|
2582
|
+
ADD CONSTRAINT skr_vouchers_vendor_id_fk FOREIGN KEY (vendor_id) REFERENCES skr_vendors(id);
|
2583
|
+
|
2584
|
+
|
2585
|
+
--
|
2586
|
+
-- PostgreSQL database dump complete
|
2587
|
+
--
|
2588
|
+
|
2589
|
+
SET search_path TO "$user",public;
|
2590
|
+
|
2591
|
+
INSERT INTO schema_migrations (version) VALUES ('20120110142845');
|
2592
|
+
|
2593
|
+
INSERT INTO schema_migrations (version) VALUES ('20140202185309');
|
2594
|
+
|
2595
|
+
INSERT INTO schema_migrations (version) VALUES ('20140202193316');
|
2596
|
+
|
2597
|
+
INSERT INTO schema_migrations (version) VALUES ('20140202193318');
|
2598
|
+
|
2599
|
+
INSERT INTO schema_migrations (version) VALUES ('20140202193319');
|
2600
|
+
|
2601
|
+
INSERT INTO schema_migrations (version) VALUES ('20140202193700');
|
2602
|
+
|
2603
|
+
INSERT INTO schema_migrations (version) VALUES ('20140213040608');
|
2604
|
+
|
2605
|
+
INSERT INTO schema_migrations (version) VALUES ('20140220031700');
|
2606
|
+
|
2607
|
+
INSERT INTO schema_migrations (version) VALUES ('20140220031800');
|
2608
|
+
|
2609
|
+
INSERT INTO schema_migrations (version) VALUES ('20140220190836');
|
2610
|
+
|
2611
|
+
INSERT INTO schema_migrations (version) VALUES ('20140220203029');
|
2612
|
+
|
2613
|
+
INSERT INTO schema_migrations (version) VALUES ('20140224034759');
|
2614
|
+
|
2615
|
+
INSERT INTO schema_migrations (version) VALUES ('20140225032853');
|
2616
|
+
|
2617
|
+
INSERT INTO schema_migrations (version) VALUES ('20140320030501');
|
2618
|
+
|
2619
|
+
INSERT INTO schema_migrations (version) VALUES ('20140321031604');
|
2620
|
+
|
2621
|
+
INSERT INTO schema_migrations (version) VALUES ('20140322012143');
|
2622
|
+
|
2623
|
+
INSERT INTO schema_migrations (version) VALUES ('20140322014401');
|
2624
|
+
|
2625
|
+
INSERT INTO schema_migrations (version) VALUES ('20140322023453');
|
2626
|
+
|
2627
|
+
INSERT INTO schema_migrations (version) VALUES ('20140322035024');
|
2628
|
+
|
2629
|
+
INSERT INTO schema_migrations (version) VALUES ('20140322223912');
|
2630
|
+
|
2631
|
+
INSERT INTO schema_migrations (version) VALUES ('20140322223920');
|
2632
|
+
|
2633
|
+
INSERT INTO schema_migrations (version) VALUES ('20140323001446');
|
2634
|
+
|
2635
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327202102');
|
2636
|
+
|
2637
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327202107');
|
2638
|
+
|
2639
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327202207');
|
2640
|
+
|
2641
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327202209');
|
2642
|
+
|
2643
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327224000');
|
2644
|
+
|
2645
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327224002');
|
2646
|
+
|
2647
|
+
INSERT INTO schema_migrations (version) VALUES ('20140330232808');
|
2648
|
+
|
2649
|
+
INSERT INTO schema_migrations (version) VALUES ('20140330232810');
|
2650
|
+
|
2651
|
+
INSERT INTO schema_migrations (version) VALUES ('20140400164729');
|
2652
|
+
|
2653
|
+
INSERT INTO schema_migrations (version) VALUES ('20140400164733');
|
2654
|
+
|
2655
|
+
INSERT INTO schema_migrations (version) VALUES ('20140401164729');
|
2656
|
+
|
2657
|
+
INSERT INTO schema_migrations (version) VALUES ('20140401164740');
|
2658
|
+
|
2659
|
+
INSERT INTO schema_migrations (version) VALUES ('20140422024010');
|
2660
|
+
|
2661
|
+
INSERT INTO schema_migrations (version) VALUES ('20140615031600');
|
2662
|
+
|