stockor 0.1.9 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +254 -72
- data/Guardfile +1 -1
- data/README.md +24 -3
- data/app.json +28 -0
- data/client/skr/Extension.coffee +18 -0
- data/client/skr/components/BankAccountFinder.cjsx +34 -0
- data/client/skr/components/Currency.cjsx +19 -0
- data/client/skr/components/CustomerFinder.cjsx +37 -0
- data/client/skr/components/CustomerLink.cjsx +13 -0
- data/client/skr/components/CustomerProjectFinder.cjsx +49 -0
- data/client/skr/components/GlAccountChooser.cjsx +38 -0
- data/client/skr/components/InvoiceFinder.cjsx +37 -0
- data/client/skr/components/InvoiceLink.cjsx +13 -0
- data/client/skr/components/LocationChooser.cjsx +37 -0
- data/client/skr/components/PaymentCategoryFinder.cjsx +34 -0
- data/client/skr/components/PrintFormChooser.cjsx +29 -0
- data/client/skr/components/SalesOrderFinder.cjsx +38 -0
- data/client/skr/components/ScreenControls.cjsx +20 -0
- data/client/skr/components/SkuFinder.cjsx +30 -0
- data/client/skr/components/SkuLines.cjsx +76 -0
- data/client/skr/components/SystemSettings.cjsx +26 -0
- data/client/skr/components/TermsChooser.cjsx +40 -0
- data/client/skr/components/ToolbarButton.cjsx +7 -0
- data/client/skr/components/TotalsLine.cjsx +21 -0
- data/client/skr/components/TriStateIcon.cjsx +12 -0
- data/client/skr/components/UOMChooser.cjsx +24 -0
- data/client/skr/components/UserPreferences.cjsx +30 -0
- data/client/skr/components/VendorFinder.cjsx +40 -0
- data/client/skr/components/address/Address.cjsx +10 -10
- data/client/skr/components/styles.scss +16 -0
- data/client/skr/index.js +3 -1
- data/client/skr/models/Address.coffee +9 -1
- data/client/skr/models/BankAccount.coffee +17 -0
- data/client/skr/models/Base.coffee +6 -0
- data/client/skr/models/Customer.coffee +17 -10
- data/client/skr/models/CustomerProject.coffee +29 -0
- data/client/skr/models/GlAccount.coffee +22 -10
- data/client/skr/models/GlManualEntry.coffee +4 -2
- data/client/skr/models/GlPeriod.coffee +4 -6
- data/client/skr/models/GlPosting.coffee +7 -7
- data/client/skr/models/GlTransaction.coffee +3 -3
- data/client/skr/models/IaLine.coffee +9 -9
- data/client/skr/models/IaReason.coffee +4 -4
- data/client/skr/models/InvLine.coffee +30 -11
- data/client/skr/models/InventoryAdjustment.coffee +8 -6
- data/client/skr/models/Invoice.coffee +89 -18
- data/client/skr/models/Location.coffee +27 -6
- data/client/skr/models/Payment.coffee +36 -0
- data/client/skr/models/PaymentCategory.coffee +12 -0
- data/client/skr/models/PaymentTerm.coffee +17 -4
- data/client/skr/models/PickTicket.coffee +7 -5
- data/client/skr/models/PoLine.coffee +15 -15
- data/client/skr/models/PoReceipt.coffee +8 -6
- data/client/skr/models/PorLine.coffee +11 -11
- data/client/skr/models/PricingProvider.coffee +6 -0
- data/client/skr/models/PtLine.coffee +13 -13
- data/client/skr/models/PurchaseOrder.coffee +11 -9
- data/client/skr/models/SalesOrder.coffee +59 -22
- data/client/skr/models/Sku.coffee +17 -15
- data/client/skr/models/SkuLoc.coffee +14 -9
- data/client/skr/models/SkuTran.coffee +10 -10
- data/client/skr/models/SkuVendor.coffee +9 -9
- data/client/skr/models/SoLine.coffee +27 -20
- data/client/skr/models/TimeEntry.coffee +75 -0
- data/client/skr/models/Uom.coffee +27 -6
- data/client/skr/models/Vendor.coffee +14 -12
- data/client/skr/models/VoLine.coffee +11 -11
- data/client/skr/models/Voucher.coffee +7 -5
- data/client/skr/models/mixins/HasVisibleId.coffee +7 -0
- data/client/skr/models/mixins/PrintSupport.coffee +6 -0
- data/client/skr/models/mixins/SkuLine.coffee +61 -0
- data/client/skr/screens/Commands.coffee +29 -0
- data/client/skr/screens/bank-maint/BankMaint.cjsx +43 -0
- data/client/skr/screens/bank-maint/index.js +5 -0
- data/client/skr/screens/chart-of-accounts/ChartOfAccounts.cjsx +40 -0
- data/client/skr/screens/chart-of-accounts/index.js +1 -0
- data/client/skr/screens/chart-of-accounts/index.scss +12 -0
- data/client/skr/screens/customer-maint/CustomerMaint.cjsx +35 -36
- data/client/skr/screens/customer-projects/CustomerProjects.cjsx +70 -0
- data/client/skr/screens/customer-projects/index.js +5 -0
- data/client/skr/screens/customer-projects/index.scss +25 -0
- data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +35 -0
- data/client/skr/screens/fresh-books-import/ChooseRecords.cjsx +116 -0
- data/client/skr/screens/fresh-books-import/FreshBooksImport.cjsx +31 -0
- data/client/skr/screens/fresh-books-import/Import.coffee +52 -0
- data/client/skr/screens/fresh-books-import/ViewRecords.cjsx +96 -0
- data/client/skr/screens/fresh-books-import/index.js +1 -0
- data/client/skr/screens/fresh-books-import/index.scss +39 -0
- data/client/skr/screens/gl-accounts/GlAccounts.cjsx +31 -0
- data/client/skr/screens/gl-accounts/index.js +5 -0
- data/client/skr/screens/gl-transactions/GlTransactions.cjsx +46 -0
- data/client/skr/screens/gl-transactions/index.js +1 -0
- data/client/skr/screens/gl-transactions/index.scss +12 -0
- data/client/skr/screens/invoice/Invoice.cjsx +92 -0
- data/client/skr/screens/invoice/Payment.cjsx +28 -0
- data/client/skr/screens/invoice/index.js +5 -0
- data/client/skr/screens/locations/Locations.cjsx +31 -0
- data/client/skr/screens/locations/index.js +5 -0
- data/client/skr/screens/payment-category/PaymentCategory.cjsx +28 -0
- data/client/skr/screens/payment-category/index.js +5 -0
- data/client/skr/screens/payment-category/index.scss +9 -0
- data/client/skr/screens/payment-terms/PaymentTerms.cjsx +28 -0
- data/client/skr/screens/payment-terms/index.js +5 -0
- data/client/skr/screens/payment-terms/index.scss +9 -0
- data/client/skr/screens/payments/Payments.cjsx +59 -0
- data/client/skr/screens/payments/index.js +5 -0
- data/client/skr/screens/sales-order/SalesOrder.cjsx +68 -0
- data/client/skr/screens/sales-order/index.js +1 -5
- data/client/skr/screens/sku-maint/SkuMaint.cjsx +53 -0
- data/client/skr/screens/sku-maint/SkuUomList.cjsx +209 -0
- data/client/skr/screens/sku-maint/index.js +2 -5
- data/client/skr/screens/sku-maint/index.scss +37 -6
- data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +156 -0
- data/client/skr/screens/time-invoicing/index.js +5 -0
- data/client/skr/screens/time-invoicing/index.scss +7 -0
- data/client/skr/screens/time-tracking/EditEntry.cjsx +54 -0
- data/client/skr/screens/time-tracking/Entries.coffee +132 -0
- data/client/skr/screens/time-tracking/Header.cjsx +71 -0
- data/client/skr/screens/time-tracking/Popover.cjsx +70 -0
- data/client/skr/screens/time-tracking/PopoverMiniControls.cjsx +25 -0
- data/client/skr/screens/time-tracking/TimeTracking.cjsx +63 -0
- data/client/skr/screens/time-tracking/WeekSummary.cjsx +16 -0
- data/client/skr/screens/time-tracking/index.js +1 -0
- data/client/skr/screens/time-tracking/index.scss +126 -0
- data/client/skr/screens/vendor-maint/VendorMaint.cjsx +45 -0
- data/client/skr/screens/vendor-maint/index.js +1 -5
- data/client/skr/styles.scss +1 -13
- data/config/puma.rb +4 -0
- data/config/routes.rb +21 -9
- data/config/screens.rb +147 -32
- data/db/migrate/20140202194700_create_skr_gl_transaction_details.rb +35 -0
- data/db/migrate/20140220031800_create_skr_locations.rb +2 -0
- data/db/migrate/20140220190836_create_skr_vendors.rb +1 -0
- data/db/migrate/20140220203029_create_skr_customers.rb +3 -2
- data/db/migrate/20140224034759_create_skr_skus.rb +2 -3
- data/db/migrate/20140322223912_create_skr_sales_orders.rb +4 -3
- data/db/migrate/20140322223920_create_skr_so_lines.rb +4 -5
- data/db/migrate/20140323001446_create_so_details_view.rb +7 -5
- data/db/migrate/20140327202209_create_skr_pt_lines.rb +2 -2
- data/db/migrate/20140327214000_create_customer_project.rb +16 -0
- data/db/migrate/20140327223002_create_time_entries.rb +17 -0
- data/db/migrate/20140327224000_create_skr_invoices.rb +5 -1
- data/db/migrate/20140327224002_create_skr_inv_lines.rb +3 -1
- data/db/migrate/20140422024010_create_skr_inv_details_view.rb +1 -1
- data/db/migrate/20151121211323_create_customer_project_details_views.rb +31 -0
- data/db/migrate/20160216142845_create_gl_account_balances_view.rb +20 -0
- data/db/migrate/20160229002044_create_bank_accounts.rb +18 -0
- data/db/migrate/20160229041711_create_payments.rb +33 -0
- data/db/migrate/20160307022705_create_create_combined_uom_views.rb +18 -0
- data/db/schema.sql +639 -140
- data/db/seed/chart_of_accounts.yml +8 -6
- data/db/seed/payment_categories.yml +12 -0
- data/db/seed/skus.yml +32 -0
- data/db/seed.rb +21 -0
- data/lib/skr/access_roles.rb +19 -6
- data/lib/skr/concerns/has_sku_loc_lines.rb +0 -16
- data/lib/skr/concerns/inv_extensions.rb +24 -0
- data/lib/skr/concerns/is_sku_loc_line.rb +3 -4
- data/lib/skr/concerns/so_extensions.rb +8 -0
- data/lib/skr/concerns/visible_id_identifier.rb +1 -1
- data/lib/skr/db/migration_helpers.rb +2 -4
- data/lib/skr/extension.rb +11 -4
- data/lib/skr/handlers/fresh_books_import.rb +20 -0
- data/lib/skr/handlers/invoice_from_time_entries.rb +49 -0
- data/lib/skr/jobs/fresh_books/base.rb +54 -0
- data/lib/skr/jobs/fresh_books/import.rb +151 -0
- data/lib/skr/jobs/fresh_books/retrieve.rb +62 -0
- data/lib/skr/model.rb +5 -0
- data/lib/skr/models/address.rb +1 -1
- data/lib/skr/models/bank_account.rb +13 -0
- data/lib/skr/models/business_entity.rb +3 -0
- data/lib/skr/models/customer.rb +1 -1
- data/lib/skr/models/customer_project.rb +22 -0
- data/lib/skr/models/gl_account.rb +13 -3
- data/lib/skr/models/gl_period.rb +6 -0
- data/lib/skr/models/gl_posting.rb +7 -4
- data/lib/skr/models/gl_transaction.rb +19 -33
- data/lib/skr/models/ia_line.rb +1 -1
- data/lib/skr/models/inv_line.rb +33 -15
- data/lib/skr/models/invoice.rb +47 -20
- data/lib/skr/models/location.rb +7 -1
- data/lib/skr/models/payment.rb +49 -0
- data/lib/skr/models/payment_category.rb +11 -0
- data/lib/skr/models/payment_term.rb +1 -1
- data/lib/skr/models/por_line.rb +1 -1
- data/lib/skr/models/pt_line.rb +1 -1
- data/lib/skr/models/sales_order.rb +9 -9
- data/lib/skr/models/sku_loc.rb +1 -1
- data/lib/skr/models/sku_tran.rb +6 -11
- data/lib/skr/models/so_line.rb +22 -12
- data/lib/skr/models/time_entry.rb +36 -0
- data/lib/skr/models/uom.rb +11 -10
- data/lib/skr/models/user_proxy.rb +1 -1
- data/lib/skr/number.rb +25 -0
- data/lib/skr/print/form.rb +46 -0
- data/lib/skr/print/template.rb +48 -0
- data/lib/skr/print.rb +11 -0
- data/lib/skr/string.rb +11 -0
- data/lib/skr/version.rb +1 -1
- data/lib/skr.rb +9 -0
- data/spec/fixtures/skr/address.yml +164 -4
- data/spec/fixtures/skr/bank_account.yml +8 -0
- data/spec/fixtures/skr/customer.yml +30 -4
- data/spec/fixtures/skr/customer_project.yml +20 -0
- data/spec/fixtures/skr/gl_account.yml +19 -1
- data/spec/fixtures/skr/gl_period.yml +3 -0
- data/spec/fixtures/skr/gl_posting.yml +22 -1
- data/spec/fixtures/skr/gl_transaction.yml +4 -1
- data/spec/fixtures/skr/inv_line.yml +35 -0
- data/spec/fixtures/skr/invoice.yml +13 -2
- data/spec/fixtures/skr/location.yml +5 -0
- data/spec/fixtures/skr/payment.yml +10 -0
- data/spec/fixtures/skr/payment_category.yml +8 -0
- data/spec/fixtures/skr/payment_term.yml +37 -3
- data/spec/fixtures/skr/sales_order.yml +12 -1
- data/spec/fixtures/skr/sku.yml +78 -1
- data/spec/fixtures/skr/sku_loc.yml +42 -1
- data/spec/fixtures/skr/sku_tran.yml +24 -1
- data/spec/fixtures/skr/so_line.yml +32 -0
- data/spec/fixtures/skr/time_entry.yml +82 -0
- data/spec/fixtures/skr/uom.yml +52 -1
- data/spec/fixtures/skr/vendor.yml +28 -1
- data/spec/fixtures/stockor.png +0 -0
- data/spec/server/bank_account_spec.rb +10 -0
- data/spec/server/customer_project_spec.rb +10 -0
- data/spec/server/handlers/invoice_from_time_entries_spec.rb +49 -0
- data/spec/server/jobs/fresh_books/import_spec.rb +69 -0
- data/spec/server/jobs/fresh_books/retrieve_spec.rb +37 -0
- data/spec/server/models/address_spec.rb +4 -3
- data/spec/server/models/gl_transaction_spec.rb +3 -3
- data/spec/server/models/inv_line_spec.rb +83 -3
- data/spec/server/models/invoice_spec.rb +32 -3
- data/spec/server/models/payment_spec.rb +40 -0
- data/spec/server/models/sales_order_spec.rb +1 -1
- data/spec/server/models/so_line_spec.rb +3 -3
- data/spec/server/models/spec_helper_spec.rb +1 -1
- data/spec/server/payment_spec.rb +10 -0
- data/spec/server/print/form_spec.rb +47 -0
- data/spec/server/print/template_spec.rb +36 -0
- data/spec/server/spec_helper.rb +14 -1
- data/spec/server/time_entry_spec.rb +10 -0
- data/spec/skr/components/SkuLinesSpec.coffee +61 -0
- data/spec/skr/models/BankAccountSpec.coffee +5 -0
- data/spec/skr/models/CustomerProjectSpec.coffee +5 -0
- data/spec/skr/models/CustomerSpec.coffee +2 -2
- data/spec/skr/models/PaymentSpec.coffee +5 -0
- data/spec/skr/models/SalesOrderSpec.coffee +21 -5
- data/spec/skr/models/SoLineSpec.coffee +7 -2
- data/spec/skr/models/TimeEntrySpec.coffee +5 -0
- data/spec/skr/screens/bank-maint/BankMaintSpec.coffee +5 -0
- data/spec/skr/screens/customer-projects/CustomerProjectsSpec.coffee +5 -0
- data/spec/skr/screens/fresh-books-import/FreshBooksImportSpec.coffee +1 -0
- data/spec/skr/screens/gl-accounts/GlAccountsSpec.coffee +5 -0
- data/spec/skr/screens/invoice/InvoiceSpec.coffee +5 -0
- data/spec/skr/screens/locations/LocationsSpec.coffee +5 -0
- data/spec/skr/screens/payment-category/PaymentCategorySpec.coffee +5 -0
- data/spec/skr/screens/payment-terms/PaymentTermsSpec.coffee +5 -0
- data/spec/skr/screens/payments/PaymentsSpec.coffee +5 -0
- data/spec/skr/screens/time-invoicing/TimeInvoicingSpec.coffee +5 -0
- data/spec/skr/screens/time-tracking/TimeTrackingSpec.coffee +14 -0
- data/spec/vcr/freshbooks.yml +698 -0
- data/stockor.gemspec +5 -1
- data/templates/print/fonts/GnuMICR.otf +0 -0
- data/templates/print/layout.tex.erb +39 -0
- data/templates/print/packages/booktabs.sty +182 -0
- data/templates/print/packages/fancybox.sty +966 -0
- data/templates/print/packages/fancyhdr.sty +485 -0
- data/templates/print/packages/graphbox.sty +129 -0
- data/templates/print/packages/lastpage.sty +283 -0
- data/templates/print/packages/lastpage209.sty +70 -0
- data/templates/print/packages/marginnote.sty +412 -0
- data/templates/print/packages/multirow.sty +159 -0
- data/templates/print/packages/rotating.sty +282 -0
- data/templates/print/packages/tabu.sty +2557 -0
- data/templates/print/packages/textpos.sty +361 -0
- data/templates/print/packages/varwidth.sty +318 -0
- data/templates/print/partials/address.tex.erb +6 -0
- data/templates/print/partials/bill_to_ship_to.tex.erb +13 -0
- data/templates/print/partials/header.tex.erb +13 -0
- data/templates/print/partials/invoice_paid_state.tex.erb +2 -0
- data/templates/print/partials/old/inv_lines_grouping.tex.erb +8 -0
- data/templates/print/partials/old/labor_lines_footer.tex.erb +18 -0
- data/templates/print/partials/skus_table.tex.erb +32 -0
- data/templates/print/partials/skus_table_col_hdr.tex.erb +8 -0
- data/templates/print/partials/skus_table_footer.tex.erb +5 -0
- data/templates/print/partials/skus_table_group_footer.tex.erb +4 -0
- data/templates/print/partials/skus_table_invoice_footer.tex.erb +25 -0
- data/templates/print/partials/skus_table_invoice_info_line.tex.erb +16 -0
- data/templates/print/partials/skus_table_labor_col_hdr.tex.erb +8 -0
- data/templates/print/partials/skus_table_labor_group_footer.tex.erb +7 -0
- data/templates/print/partials/skus_table_labor_line.tex.erb +11 -0
- data/templates/print/partials/skus_table_line.tex.erb +6 -0
- data/templates/print/partials/skus_table_other_charge_lines.tex.erb +7 -0
- data/templates/print/partials/so_info_line.tex.erb +14 -0
- data/templates/print/types/invoice/default.tex.erb +13 -0
- data/templates/print/types/invoice/labor.tex.erb +33 -0
- data/templates/print/types/payment/default.tex.erb +64 -0
- data/templates/print/types/sales-order/default.tex.erb +8 -0
- metadata +252 -15
- data/client/skr/components/address/address.html +0 -20
- data/client/skr/models/mixins/CodeField.coffee +0 -5
- data/client/skr/screens/customer-maint/index.scss +0 -11
- data/client/skr/screens/customer-maint/layout.html +0 -32
- data/client/skr/screens/sales-order/SalesOrder.coffee +0 -30
- data/client/skr/screens/sales-order/index.scss +0 -8
- data/client/skr/screens/sales-order/layout.html +0 -30
- data/client/skr/screens/sku-maint/SkuMaint.coffee +0 -18
- data/client/skr/screens/sku-maint/layout.html +0 -16
- data/client/skr/screens/vendor-maint/VendorMaint.coffee +0 -28
- data/client/skr/screens/vendor-maint/index.scss +0 -8
- data/client/skr/screens/vendor-maint/layout.html +0 -32
data/db/schema.sql
CHANGED
@@ -76,7 +76,7 @@ CREATE TABLE lanes_users (
|
|
76
76
|
email character varying NOT NULL,
|
77
77
|
password_digest character varying NOT NULL,
|
78
78
|
role_names character varying[] DEFAULT '{}'::character varying[] NOT NULL,
|
79
|
-
options
|
79
|
+
options jsonb DEFAULT '{}'::jsonb NOT NULL,
|
80
80
|
created_at timestamp without time zone NOT NULL,
|
81
81
|
updated_at timestamp without time zone NOT NULL
|
82
82
|
);
|
@@ -150,6 +150,97 @@ CREATE SEQUENCE skr_addresses_id_seq
|
|
150
150
|
ALTER SEQUENCE skr_addresses_id_seq OWNED BY skr_addresses.id;
|
151
151
|
|
152
152
|
|
153
|
+
--
|
154
|
+
-- Name: skr_bank_accounts; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
155
|
+
--
|
156
|
+
|
157
|
+
CREATE TABLE skr_bank_accounts (
|
158
|
+
id integer NOT NULL,
|
159
|
+
code text NOT NULL,
|
160
|
+
name text NOT NULL,
|
161
|
+
description text,
|
162
|
+
routing_number text,
|
163
|
+
account_number text,
|
164
|
+
address_id integer NOT NULL,
|
165
|
+
gl_account_id integer NOT NULL,
|
166
|
+
created_at timestamp without time zone NOT NULL,
|
167
|
+
updated_at timestamp without time zone NOT NULL
|
168
|
+
);
|
169
|
+
|
170
|
+
|
171
|
+
--
|
172
|
+
-- Name: skr_bank_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
173
|
+
--
|
174
|
+
|
175
|
+
CREATE SEQUENCE skr_bank_accounts_id_seq
|
176
|
+
START WITH 1
|
177
|
+
INCREMENT BY 1
|
178
|
+
NO MINVALUE
|
179
|
+
NO MAXVALUE
|
180
|
+
CACHE 1;
|
181
|
+
|
182
|
+
|
183
|
+
--
|
184
|
+
-- Name: skr_bank_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
185
|
+
--
|
186
|
+
|
187
|
+
ALTER SEQUENCE skr_bank_accounts_id_seq OWNED BY skr_bank_accounts.id;
|
188
|
+
|
189
|
+
|
190
|
+
--
|
191
|
+
-- Name: skr_uoms; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
192
|
+
--
|
193
|
+
|
194
|
+
CREATE TABLE skr_uoms (
|
195
|
+
id integer NOT NULL,
|
196
|
+
sku_id integer NOT NULL,
|
197
|
+
price numeric(15,2) NOT NULL,
|
198
|
+
size smallint DEFAULT 1 NOT NULL,
|
199
|
+
code character varying DEFAULT 'EA'::character varying NOT NULL,
|
200
|
+
weight numeric(6,1),
|
201
|
+
height numeric(6,1),
|
202
|
+
width numeric(6,1),
|
203
|
+
depth numeric(6,1),
|
204
|
+
created_at timestamp without time zone NOT NULL,
|
205
|
+
created_by_id integer NOT NULL,
|
206
|
+
updated_at timestamp without time zone NOT NULL,
|
207
|
+
updated_by_id integer NOT NULL
|
208
|
+
);
|
209
|
+
|
210
|
+
|
211
|
+
--
|
212
|
+
-- Name: skr_combined_uom; Type: VIEW; Schema: public; Owner: -
|
213
|
+
--
|
214
|
+
|
215
|
+
CREATE VIEW skr_combined_uom AS
|
216
|
+
SELECT uom.id AS skr_uom_id,
|
217
|
+
CASE
|
218
|
+
WHEN (uom.size = 1) THEN (uom.code)::text
|
219
|
+
ELSE (((uom.code)::text || '/'::text) || uom.size)
|
220
|
+
END AS combined_uom
|
221
|
+
FROM skr_uoms uom;
|
222
|
+
|
223
|
+
|
224
|
+
--
|
225
|
+
-- Name: skr_customer_projects; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
226
|
+
--
|
227
|
+
|
228
|
+
CREATE TABLE skr_customer_projects (
|
229
|
+
id integer NOT NULL,
|
230
|
+
code character varying NOT NULL,
|
231
|
+
name text,
|
232
|
+
description text,
|
233
|
+
po_num text,
|
234
|
+
sku_id integer NOT NULL,
|
235
|
+
customer_id integer NOT NULL,
|
236
|
+
invoice_form character varying,
|
237
|
+
rates jsonb,
|
238
|
+
options jsonb,
|
239
|
+
created_at timestamp without time zone NOT NULL,
|
240
|
+
updated_at timestamp without time zone NOT NULL
|
241
|
+
);
|
242
|
+
|
243
|
+
|
153
244
|
--
|
154
245
|
-- Name: skr_customers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
155
246
|
--
|
@@ -163,11 +254,35 @@ CREATE TABLE skr_customers (
|
|
163
254
|
gl_receivables_account_id integer NOT NULL,
|
164
255
|
credit_limit numeric(15,2) DEFAULT 0.0,
|
165
256
|
open_balance numeric(15,2) DEFAULT 0.0,
|
257
|
+
is_tax_exempt boolean DEFAULT false NOT NULL,
|
166
258
|
hash_code character varying NOT NULL,
|
167
259
|
name character varying NOT NULL,
|
168
260
|
notes text,
|
169
261
|
website text,
|
170
|
-
options
|
262
|
+
options jsonb,
|
263
|
+
forms jsonb,
|
264
|
+
created_at timestamp without time zone NOT NULL,
|
265
|
+
created_by_id integer NOT NULL,
|
266
|
+
updated_at timestamp without time zone NOT NULL,
|
267
|
+
updated_by_id integer NOT NULL
|
268
|
+
);
|
269
|
+
|
270
|
+
|
271
|
+
--
|
272
|
+
-- Name: skr_skus; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
273
|
+
--
|
274
|
+
|
275
|
+
CREATE TABLE skr_skus (
|
276
|
+
id integer NOT NULL,
|
277
|
+
default_vendor_id integer,
|
278
|
+
gl_asset_account_id integer NOT NULL,
|
279
|
+
default_uom_code character varying NOT NULL,
|
280
|
+
code character varying NOT NULL,
|
281
|
+
description character varying NOT NULL,
|
282
|
+
is_discontinued boolean DEFAULT false NOT NULL,
|
283
|
+
is_other_charge boolean DEFAULT false NOT NULL,
|
284
|
+
does_track_inventory boolean DEFAULT false NOT NULL,
|
285
|
+
can_backorder boolean DEFAULT false NOT NULL,
|
171
286
|
created_at timestamp without time zone NOT NULL,
|
172
287
|
created_by_id integer NOT NULL,
|
173
288
|
updated_at timestamp without time zone NOT NULL,
|
@@ -175,6 +290,40 @@ CREATE TABLE skr_customers (
|
|
175
290
|
);
|
176
291
|
|
177
292
|
|
293
|
+
--
|
294
|
+
-- Name: skr_customer_project_details; Type: VIEW; Schema: public; Owner: -
|
295
|
+
--
|
296
|
+
|
297
|
+
CREATE VIEW skr_customer_project_details AS
|
298
|
+
SELECT cp.id AS skr_customer_project_id,
|
299
|
+
c.code AS customer_code,
|
300
|
+
c.name AS customer_description,
|
301
|
+
s.code AS sku_code,
|
302
|
+
s.description AS sku_description
|
303
|
+
FROM ((skr_customer_projects cp
|
304
|
+
JOIN skr_skus s ON ((s.id = cp.sku_id)))
|
305
|
+
JOIN skr_customers c ON ((c.id = cp.customer_id)));
|
306
|
+
|
307
|
+
|
308
|
+
--
|
309
|
+
-- Name: skr_customer_projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
310
|
+
--
|
311
|
+
|
312
|
+
CREATE SEQUENCE skr_customer_projects_id_seq
|
313
|
+
START WITH 1
|
314
|
+
INCREMENT BY 1
|
315
|
+
NO MINVALUE
|
316
|
+
NO MAXVALUE
|
317
|
+
CACHE 1;
|
318
|
+
|
319
|
+
|
320
|
+
--
|
321
|
+
-- Name: skr_customer_projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
322
|
+
--
|
323
|
+
|
324
|
+
ALTER SEQUENCE skr_customer_projects_id_seq OWNED BY skr_customer_projects.id;
|
325
|
+
|
326
|
+
|
178
327
|
--
|
179
328
|
-- Name: skr_customers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
180
329
|
--
|
@@ -194,6 +343,19 @@ CREATE SEQUENCE skr_customers_id_seq
|
|
194
343
|
ALTER SEQUENCE skr_customers_id_seq OWNED BY skr_customers.id;
|
195
344
|
|
196
345
|
|
346
|
+
--
|
347
|
+
-- Name: skr_gl_account_balances; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
348
|
+
--
|
349
|
+
|
350
|
+
CREATE TABLE skr_gl_account_balances (
|
351
|
+
skr_gl_account_id integer,
|
352
|
+
branch_number text,
|
353
|
+
balance numeric
|
354
|
+
);
|
355
|
+
|
356
|
+
ALTER TABLE ONLY skr_gl_account_balances REPLICA IDENTITY NOTHING;
|
357
|
+
|
358
|
+
|
197
359
|
--
|
198
360
|
-- Name: skr_gl_accounts; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
199
361
|
--
|
@@ -236,7 +398,7 @@ ALTER SEQUENCE skr_gl_accounts_id_seq OWNED BY skr_gl_accounts.id;
|
|
236
398
|
|
237
399
|
CREATE TABLE skr_gl_manual_entries (
|
238
400
|
id integer NOT NULL,
|
239
|
-
visible_id
|
401
|
+
visible_id character varying NOT NULL,
|
240
402
|
notes text,
|
241
403
|
created_at timestamp without time zone NOT NULL,
|
242
404
|
created_by_id integer NOT NULL,
|
@@ -350,6 +512,32 @@ CREATE TABLE skr_gl_transactions (
|
|
350
512
|
);
|
351
513
|
|
352
514
|
|
515
|
+
--
|
516
|
+
-- Name: skr_gl_transaction_details; Type: VIEW; Schema: public; Owner: -
|
517
|
+
--
|
518
|
+
|
519
|
+
CREATE VIEW skr_gl_transaction_details AS
|
520
|
+
SELECT glt.id AS gl_transaction_id,
|
521
|
+
to_char(glt.created_at, 'YYYY-MM-DD'::text) AS transaction_date,
|
522
|
+
pr.period AS accounting_period,
|
523
|
+
pr.year AS accounting_year,
|
524
|
+
( SELECT array_agg(skr_gl_postings.account_number) AS array_agg
|
525
|
+
FROM skr_gl_postings
|
526
|
+
WHERE (skr_gl_postings.gl_transaction_id = glt.id)) AS account_numbers,
|
527
|
+
( SELECT array_to_json(array_agg(row_to_json(postings.*))) AS array_to_json
|
528
|
+
FROM ( SELECT skr_gl_postings.account_number,
|
529
|
+
skr_gl_postings.amount
|
530
|
+
FROM skr_gl_postings
|
531
|
+
WHERE ((skr_gl_postings.gl_transaction_id = glt.id) AND (skr_gl_postings.is_debit = true))) postings) AS debit_details,
|
532
|
+
( SELECT array_to_json(array_agg(row_to_json(postings.*))) AS array_to_json
|
533
|
+
FROM ( SELECT skr_gl_postings.account_number,
|
534
|
+
skr_gl_postings.amount
|
535
|
+
FROM skr_gl_postings
|
536
|
+
WHERE ((skr_gl_postings.gl_transaction_id = glt.id) AND (skr_gl_postings.is_debit = false))) postings) AS credit_details
|
537
|
+
FROM (skr_gl_transactions glt
|
538
|
+
JOIN skr_gl_periods pr ON ((pr.id = glt.period_id)));
|
539
|
+
|
540
|
+
|
353
541
|
--
|
354
542
|
-- Name: skr_gl_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
355
543
|
--
|
@@ -453,14 +641,16 @@ CREATE TABLE skr_inv_lines (
|
|
453
641
|
sku_loc_id integer NOT NULL,
|
454
642
|
pt_line_id integer,
|
455
643
|
so_line_id integer,
|
644
|
+
time_entry_id integer,
|
456
645
|
price numeric(15,2) NOT NULL,
|
457
646
|
sku_code character varying NOT NULL,
|
458
647
|
description character varying NOT NULL,
|
459
648
|
uom_code character varying NOT NULL,
|
460
649
|
uom_size smallint NOT NULL,
|
461
650
|
"position" smallint NOT NULL,
|
462
|
-
qty
|
651
|
+
qty numeric(15,2) NOT NULL,
|
463
652
|
is_revised boolean DEFAULT false NOT NULL,
|
653
|
+
options jsonb,
|
464
654
|
created_at timestamp without time zone NOT NULL,
|
465
655
|
created_by_id integer NOT NULL,
|
466
656
|
updated_at timestamp without time zone NOT NULL,
|
@@ -474,20 +664,24 @@ CREATE TABLE skr_inv_lines (
|
|
474
664
|
|
475
665
|
CREATE TABLE skr_invoices (
|
476
666
|
id integer NOT NULL,
|
477
|
-
visible_id
|
667
|
+
visible_id character varying NOT NULL,
|
668
|
+
state smallint DEFAULT 0 NOT NULL,
|
478
669
|
terms_id integer NOT NULL,
|
479
670
|
customer_id integer NOT NULL,
|
480
671
|
location_id integer NOT NULL,
|
672
|
+
customer_project_id integer,
|
481
673
|
sales_order_id integer,
|
482
674
|
pick_ticket_id integer,
|
483
675
|
shipping_address_id integer NOT NULL,
|
484
676
|
billing_address_id integer NOT NULL,
|
485
677
|
amount_paid numeric(15,2) DEFAULT 0.0 NOT NULL,
|
486
|
-
|
678
|
+
is_tax_exempt boolean DEFAULT false NOT NULL,
|
487
679
|
hash_code character varying NOT NULL,
|
488
680
|
invoice_date date NOT NULL,
|
489
681
|
po_num character varying,
|
490
|
-
|
682
|
+
notes text,
|
683
|
+
form character varying,
|
684
|
+
options jsonb,
|
491
685
|
created_at timestamp without time zone NOT NULL,
|
492
686
|
created_by_id integer NOT NULL,
|
493
687
|
updated_at timestamp without time zone NOT NULL,
|
@@ -501,7 +695,7 @@ CREATE TABLE skr_invoices (
|
|
501
695
|
|
502
696
|
CREATE TABLE skr_pick_tickets (
|
503
697
|
id integer NOT NULL,
|
504
|
-
visible_id
|
698
|
+
visible_id character varying NOT NULL,
|
505
699
|
sales_order_id integer NOT NULL,
|
506
700
|
location_id integer NOT NULL,
|
507
701
|
shipped_at date,
|
@@ -519,20 +713,22 @@ CREATE TABLE skr_pick_tickets (
|
|
519
713
|
|
520
714
|
CREATE TABLE skr_sales_orders (
|
521
715
|
id integer NOT NULL,
|
522
|
-
visible_id
|
716
|
+
visible_id character varying NOT NULL,
|
717
|
+
state smallint DEFAULT 0 NOT NULL,
|
523
718
|
customer_id integer NOT NULL,
|
524
719
|
location_id integer NOT NULL,
|
525
720
|
shipping_address_id integer NOT NULL,
|
526
721
|
billing_address_id integer NOT NULL,
|
527
722
|
terms_id integer NOT NULL,
|
723
|
+
is_tax_exempt boolean DEFAULT false NOT NULL,
|
528
724
|
order_date date NOT NULL,
|
529
|
-
state smallint NOT NULL,
|
530
725
|
is_revised boolean DEFAULT false NOT NULL,
|
531
726
|
hash_code character varying NOT NULL,
|
532
727
|
ship_partial boolean DEFAULT false NOT NULL,
|
533
728
|
po_num character varying,
|
534
729
|
notes text,
|
535
|
-
|
730
|
+
form character varying,
|
731
|
+
options jsonb DEFAULT '{}'::jsonb,
|
536
732
|
created_at timestamp without time zone NOT NULL,
|
537
733
|
created_by_id integer NOT NULL,
|
538
734
|
updated_at timestamp without time zone NOT NULL,
|
@@ -561,27 +757,6 @@ CREATE TABLE skr_sku_locs (
|
|
561
757
|
);
|
562
758
|
|
563
759
|
|
564
|
-
--
|
565
|
-
-- Name: skr_skus; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
566
|
-
--
|
567
|
-
|
568
|
-
CREATE TABLE skr_skus (
|
569
|
-
id integer NOT NULL,
|
570
|
-
default_vendor_id integer,
|
571
|
-
gl_asset_account_id integer NOT NULL,
|
572
|
-
default_uom_code character varying NOT NULL,
|
573
|
-
code character varying NOT NULL,
|
574
|
-
description character varying NOT NULL,
|
575
|
-
is_other_charge boolean DEFAULT false NOT NULL,
|
576
|
-
does_track_inventory boolean DEFAULT false NOT NULL,
|
577
|
-
can_backorder boolean DEFAULT false NOT NULL,
|
578
|
-
created_at timestamp without time zone NOT NULL,
|
579
|
-
created_by_id integer NOT NULL,
|
580
|
-
updated_at timestamp without time zone NOT NULL,
|
581
|
-
updated_by_id integer NOT NULL
|
582
|
-
);
|
583
|
-
|
584
|
-
|
585
760
|
--
|
586
761
|
-- Name: skr_inv_details; Type: VIEW; Schema: public; Owner: -
|
587
762
|
--
|
@@ -595,7 +770,7 @@ CREATE VIEW skr_inv_details AS
|
|
595
770
|
cust.code AS customer_code,
|
596
771
|
cust.name AS customer_name,
|
597
772
|
ba.name AS bill_addr_name,
|
598
|
-
COALESCE(ttls.total, 0.0) AS
|
773
|
+
COALESCE(ttls.total, 0.0) AS invoice_total,
|
599
774
|
COALESCE(ttls.num_lines, (0)::bigint) AS num_lines,
|
600
775
|
COALESCE(ttls.other_charge_total, (0)::numeric) AS total_other_charge_amount,
|
601
776
|
(COALESCE(ttls.total, 0.0) - COALESCE(ttls.other_charge_total, 0.0)) AS subtotal_amount
|
@@ -605,10 +780,10 @@ CREATE VIEW skr_inv_details AS
|
|
605
780
|
LEFT JOIN skr_sales_orders so ON ((so.id = inv.sales_order_id)))
|
606
781
|
LEFT JOIN skr_pick_tickets pt ON ((pt.id = inv.pick_ticket_id)))
|
607
782
|
LEFT JOIN ( SELECT ivl.invoice_id,
|
608
|
-
sum((
|
783
|
+
sum((ivl.qty * ivl.price)) AS total,
|
609
784
|
sum(
|
610
785
|
CASE
|
611
|
-
WHEN s.is_other_charge THEN (
|
786
|
+
WHEN s.is_other_charge THEN (ivl.qty * ivl.price)
|
612
787
|
ELSE (0)::numeric
|
613
788
|
END) AS other_charge_total,
|
614
789
|
count(ivl.*) AS num_lines
|
@@ -643,10 +818,10 @@ ALTER SEQUENCE skr_inv_lines_id_seq OWNED BY skr_inv_lines.id;
|
|
643
818
|
|
644
819
|
CREATE TABLE skr_inventory_adjustments (
|
645
820
|
id integer NOT NULL,
|
646
|
-
visible_id
|
821
|
+
visible_id character varying NOT NULL,
|
822
|
+
state smallint DEFAULT 0 NOT NULL,
|
647
823
|
location_id integer NOT NULL,
|
648
824
|
reason_id integer NOT NULL,
|
649
|
-
state character varying NOT NULL,
|
650
825
|
description text NOT NULL,
|
651
826
|
created_at timestamp without time zone NOT NULL,
|
652
827
|
created_by_id integer NOT NULL,
|
@@ -704,6 +879,8 @@ CREATE TABLE skr_locations (
|
|
704
879
|
address_id integer NOT NULL,
|
705
880
|
is_active boolean DEFAULT true NOT NULL,
|
706
881
|
gl_branch_code character varying(2) DEFAULT '01'::character varying NOT NULL,
|
882
|
+
logo character varying,
|
883
|
+
options jsonb,
|
707
884
|
created_at timestamp without time zone NOT NULL,
|
708
885
|
created_by_id integer NOT NULL,
|
709
886
|
updated_at timestamp without time zone NOT NULL,
|
@@ -730,6 +907,39 @@ CREATE SEQUENCE skr_locations_id_seq
|
|
730
907
|
ALTER SEQUENCE skr_locations_id_seq OWNED BY skr_locations.id;
|
731
908
|
|
732
909
|
|
910
|
+
--
|
911
|
+
-- Name: skr_payment_categories; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
912
|
+
--
|
913
|
+
|
914
|
+
CREATE TABLE skr_payment_categories (
|
915
|
+
id integer NOT NULL,
|
916
|
+
code character varying NOT NULL,
|
917
|
+
name character varying NOT NULL,
|
918
|
+
gl_account_id integer NOT NULL,
|
919
|
+
created_at timestamp without time zone NOT NULL,
|
920
|
+
updated_at timestamp without time zone NOT NULL
|
921
|
+
);
|
922
|
+
|
923
|
+
|
924
|
+
--
|
925
|
+
-- Name: skr_payment_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
926
|
+
--
|
927
|
+
|
928
|
+
CREATE SEQUENCE skr_payment_categories_id_seq
|
929
|
+
START WITH 1
|
930
|
+
INCREMENT BY 1
|
931
|
+
NO MINVALUE
|
932
|
+
NO MAXVALUE
|
933
|
+
CACHE 1;
|
934
|
+
|
935
|
+
|
936
|
+
--
|
937
|
+
-- Name: skr_payment_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
938
|
+
--
|
939
|
+
|
940
|
+
ALTER SEQUENCE skr_payment_categories_id_seq OWNED BY skr_payment_categories.id;
|
941
|
+
|
942
|
+
|
733
943
|
--
|
734
944
|
-- Name: skr_payment_terms; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
735
945
|
--
|
@@ -767,6 +977,48 @@ CREATE SEQUENCE skr_payment_terms_id_seq
|
|
767
977
|
ALTER SEQUENCE skr_payment_terms_id_seq OWNED BY skr_payment_terms.id;
|
768
978
|
|
769
979
|
|
980
|
+
--
|
981
|
+
-- Name: skr_payments; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
982
|
+
--
|
983
|
+
|
984
|
+
CREATE TABLE skr_payments (
|
985
|
+
id integer NOT NULL,
|
986
|
+
visible_id character varying NOT NULL,
|
987
|
+
bank_account_id integer NOT NULL,
|
988
|
+
category_id integer NOT NULL,
|
989
|
+
vendor_id integer,
|
990
|
+
location_id integer NOT NULL,
|
991
|
+
hash_code character varying NOT NULL,
|
992
|
+
amount numeric(15,2) NOT NULL,
|
993
|
+
date date NOT NULL,
|
994
|
+
check_number integer NOT NULL,
|
995
|
+
name text NOT NULL,
|
996
|
+
address text,
|
997
|
+
notes text,
|
998
|
+
created_at timestamp without time zone NOT NULL,
|
999
|
+
updated_at timestamp without time zone NOT NULL
|
1000
|
+
);
|
1001
|
+
|
1002
|
+
|
1003
|
+
--
|
1004
|
+
-- Name: skr_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1005
|
+
--
|
1006
|
+
|
1007
|
+
CREATE SEQUENCE skr_payments_id_seq
|
1008
|
+
START WITH 1
|
1009
|
+
INCREMENT BY 1
|
1010
|
+
NO MINVALUE
|
1011
|
+
NO MAXVALUE
|
1012
|
+
CACHE 1;
|
1013
|
+
|
1014
|
+
|
1015
|
+
--
|
1016
|
+
-- Name: skr_payments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1017
|
+
--
|
1018
|
+
|
1019
|
+
ALTER SEQUENCE skr_payments_id_seq OWNED BY skr_payments.id;
|
1020
|
+
|
1021
|
+
|
770
1022
|
--
|
771
1023
|
-- Name: skr_pick_tickets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
772
1024
|
--
|
@@ -838,7 +1090,7 @@ ALTER SEQUENCE skr_po_lines_id_seq OWNED BY skr_po_lines.id;
|
|
838
1090
|
|
839
1091
|
CREATE TABLE skr_po_receipts (
|
840
1092
|
id integer NOT NULL,
|
841
|
-
visible_id
|
1093
|
+
visible_id character varying NOT NULL,
|
842
1094
|
location_id integer NOT NULL,
|
843
1095
|
freight numeric(15,2) DEFAULT 0.0 NOT NULL,
|
844
1096
|
purchase_order_id integer NOT NULL,
|
@@ -927,7 +1179,7 @@ CREATE TABLE skr_pt_lines (
|
|
927
1179
|
bin character varying,
|
928
1180
|
uom_size smallint NOT NULL,
|
929
1181
|
"position" smallint NOT NULL,
|
930
|
-
qty
|
1182
|
+
qty numeric(15,2) NOT NULL,
|
931
1183
|
qty_invoiced integer DEFAULT 0 NOT NULL,
|
932
1184
|
is_complete boolean DEFAULT false NOT NULL
|
933
1185
|
);
|
@@ -958,12 +1210,12 @@ ALTER SEQUENCE skr_pt_lines_id_seq OWNED BY skr_pt_lines.id;
|
|
958
1210
|
|
959
1211
|
CREATE TABLE skr_purchase_orders (
|
960
1212
|
id integer NOT NULL,
|
961
|
-
visible_id
|
1213
|
+
visible_id character varying NOT NULL,
|
1214
|
+
state smallint DEFAULT 0 NOT NULL,
|
962
1215
|
vendor_id integer NOT NULL,
|
963
1216
|
location_id integer NOT NULL,
|
964
1217
|
ship_addr_id integer NOT NULL,
|
965
1218
|
terms_id integer NOT NULL,
|
966
|
-
state smallint NOT NULL,
|
967
1219
|
is_revised boolean DEFAULT false NOT NULL,
|
968
1220
|
order_date date NOT NULL,
|
969
1221
|
receiving_completed_at timestamp without time zone,
|
@@ -1043,27 +1295,6 @@ CREATE TABLE skr_sku_vendors (
|
|
1043
1295
|
);
|
1044
1296
|
|
1045
1297
|
|
1046
|
-
--
|
1047
|
-
-- Name: skr_uoms; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1048
|
-
--
|
1049
|
-
|
1050
|
-
CREATE TABLE skr_uoms (
|
1051
|
-
id integer NOT NULL,
|
1052
|
-
sku_id integer NOT NULL,
|
1053
|
-
price numeric(15,2) NOT NULL,
|
1054
|
-
size smallint DEFAULT 1 NOT NULL,
|
1055
|
-
code character varying DEFAULT 'EA'::character varying NOT NULL,
|
1056
|
-
weight numeric(6,1),
|
1057
|
-
height numeric(6,1),
|
1058
|
-
width numeric(6,1),
|
1059
|
-
depth numeric(6,1),
|
1060
|
-
created_at timestamp without time zone NOT NULL,
|
1061
|
-
created_by_id integer NOT NULL,
|
1062
|
-
updated_at timestamp without time zone NOT NULL,
|
1063
|
-
updated_by_id integer NOT NULL
|
1064
|
-
);
|
1065
|
-
|
1066
|
-
|
1067
1298
|
--
|
1068
1299
|
-- Name: skr_vendors; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1069
1300
|
--
|
@@ -1075,6 +1306,7 @@ CREATE TABLE skr_vendors (
|
|
1075
1306
|
terms_id integer NOT NULL,
|
1076
1307
|
gl_payables_account_id integer NOT NULL,
|
1077
1308
|
gl_freight_account_id integer NOT NULL,
|
1309
|
+
open_balance numeric(15,2) DEFAULT 0.0,
|
1078
1310
|
code character varying NOT NULL,
|
1079
1311
|
hash_code character varying NOT NULL,
|
1080
1312
|
name character varying NOT NULL,
|
@@ -1144,12 +1376,13 @@ CREATE TABLE skr_so_lines (
|
|
1144
1376
|
uom_code character varying NOT NULL,
|
1145
1377
|
uom_size smallint NOT NULL,
|
1146
1378
|
"position" smallint NOT NULL,
|
1147
|
-
qty
|
1148
|
-
qty_allocated
|
1149
|
-
qty_picking
|
1150
|
-
qty_invoiced
|
1151
|
-
qty_canceled
|
1379
|
+
qty numeric(15,2) NOT NULL,
|
1380
|
+
qty_allocated numeric(15,2) DEFAULT 0 NOT NULL,
|
1381
|
+
qty_picking numeric(15,2) DEFAULT 0 NOT NULL,
|
1382
|
+
qty_invoiced numeric(15,2) DEFAULT 0 NOT NULL,
|
1383
|
+
qty_canceled numeric(15,2) DEFAULT 0 NOT NULL,
|
1152
1384
|
is_revised boolean DEFAULT false NOT NULL,
|
1385
|
+
options jsonb,
|
1153
1386
|
created_at timestamp without time zone NOT NULL,
|
1154
1387
|
created_by_id integer NOT NULL,
|
1155
1388
|
updated_at timestamp without time zone NOT NULL,
|
@@ -1164,7 +1397,7 @@ CREATE TABLE skr_so_lines (
|
|
1164
1397
|
CREATE VIEW skr_sku_qty_details AS
|
1165
1398
|
SELECT s.id AS sku_id,
|
1166
1399
|
sl_ttl.qty AS qty_on_hand,
|
1167
|
-
COALESCE(sol_ttl.qty, (0)::
|
1400
|
+
COALESCE(sol_ttl.qty, (0)::numeric) AS qty_on_orders,
|
1168
1401
|
COALESCE(pol_ttl.qty, (0)::bigint) AS qty_incoming
|
1169
1402
|
FROM (((skr_skus s
|
1170
1403
|
JOIN ( SELECT sum(sl.qty) AS qty,
|
@@ -1172,16 +1405,16 @@ CREATE VIEW skr_sku_qty_details AS
|
|
1172
1405
|
FROM skr_sku_locs sl
|
1173
1406
|
GROUP BY sl.sku_id) sl_ttl ON ((sl_ttl.sku_id = s.id)))
|
1174
1407
|
LEFT JOIN ( SELECT s_1.id AS sku_id,
|
1175
|
-
sum(((sol.qty - sol.qty_canceled) * sol.uom_size)) AS qty
|
1408
|
+
sum(((sol.qty - sol.qty_canceled) * (sol.uom_size)::numeric)) AS qty
|
1176
1409
|
FROM (((skr_so_lines sol
|
1177
|
-
JOIN skr_sales_orders so ON (((so.id = sol.sales_order_id) AND (so.state <> ALL (ARRAY[5,
|
1410
|
+
JOIN skr_sales_orders so ON (((so.id = sol.sales_order_id) AND (so.state <> ALL (ARRAY[5, 10])))))
|
1178
1411
|
JOIN skr_sku_locs sl ON ((sl.id = sol.sku_loc_id)))
|
1179
1412
|
JOIN skr_skus s_1 ON ((s_1.id = sl.sku_id)))
|
1180
1413
|
GROUP BY s_1.id) sol_ttl ON ((sol_ttl.sku_id = s.id)))
|
1181
1414
|
LEFT JOIN ( SELECT s_1.id AS sku_id,
|
1182
1415
|
sum(((pol.qty - pol.qty_canceled) * pol.uom_size)) AS qty
|
1183
1416
|
FROM (((skr_po_lines pol
|
1184
|
-
JOIN skr_purchase_orders po ON (((po.id = pol.purchase_order_id) AND (po.state <> ALL (ARRAY[5,
|
1417
|
+
JOIN skr_purchase_orders po ON (((po.id = pol.purchase_order_id) AND (po.state <> ALL (ARRAY[5, 15])))))
|
1185
1418
|
JOIN skr_sku_locs sl ON ((sl.id = pol.sku_loc_id)))
|
1186
1419
|
JOIN skr_skus s_1 ON ((s_1.id = sl.sku_id)))
|
1187
1420
|
GROUP BY s_1.id) pol_ttl ON ((pol_ttl.sku_id = s.id)));
|
@@ -1271,12 +1504,12 @@ ALTER SEQUENCE skr_skus_id_seq OWNED BY skr_skus.id;
|
|
1271
1504
|
--
|
1272
1505
|
|
1273
1506
|
CREATE VIEW skr_so_allocation_details AS
|
1274
|
-
SELECT sol.sales_order_id,
|
1507
|
+
SELECT sol.sales_order_id AS skr_sales_order_id,
|
1275
1508
|
count(*) AS number_of_lines,
|
1276
|
-
sum((
|
1509
|
+
sum((sol.qty_allocated * sol.price)) AS allocated_total,
|
1277
1510
|
sum(
|
1278
1511
|
CASE
|
1279
|
-
WHEN (((sol.qty_allocated - sol.qty_canceled) - sol.qty_picking) > 0) THEN 1
|
1512
|
+
WHEN (((sol.qty_allocated - sol.qty_canceled) - sol.qty_picking) > (0)::numeric) THEN 1
|
1280
1513
|
ELSE 0
|
1281
1514
|
END) AS number_of_lines_allocated,
|
1282
1515
|
sum(
|
@@ -1290,22 +1523,43 @@ CREATE VIEW skr_so_allocation_details AS
|
|
1290
1523
|
GROUP BY sol.sales_order_id
|
1291
1524
|
HAVING (sum(
|
1292
1525
|
CASE
|
1293
|
-
WHEN (((sol.qty_allocated - sol.qty_canceled) - sol.qty_picking) > 0) THEN 1
|
1526
|
+
WHEN (((sol.qty_allocated - sol.qty_canceled) - sol.qty_picking) > (0)::numeric) THEN 1
|
1294
1527
|
ELSE 0
|
1295
1528
|
END) > 0);
|
1296
1529
|
|
1297
1530
|
|
1298
1531
|
--
|
1299
|
-
-- Name:
|
1532
|
+
-- Name: skr_so_dailly_sales_history; Type: VIEW; Schema: public; Owner: -
|
1533
|
+
--
|
1534
|
+
|
1535
|
+
CREATE VIEW skr_so_dailly_sales_history AS
|
1536
|
+
SELECT days_ago.days_ago,
|
1537
|
+
date_trunc('day'::text, ((('now'::text)::date - days_ago.days_ago))::timestamp with time zone) AS day,
|
1538
|
+
COALESCE(ttls.order_count, (0)::bigint) AS order_count,
|
1539
|
+
COALESCE(ttls.line_count, (0)::bigint) AS line_count,
|
1540
|
+
COALESCE(ttls.total, 0.0) AS line_total
|
1541
|
+
FROM (generate_series(0, 120, 1) days_ago(days_ago)
|
1542
|
+
LEFT JOIN ( SELECT count(DISTINCT sol.sales_order_id) AS order_count,
|
1543
|
+
count(*) AS line_count,
|
1544
|
+
sum((sol.price * sol.qty)) AS total,
|
1545
|
+
date_trunc('day'::text, so.created_at) AS so_date
|
1546
|
+
FROM (skr_so_lines sol
|
1547
|
+
JOIN skr_sales_orders so ON ((sol.sales_order_id = so.id)))
|
1548
|
+
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))))
|
1549
|
+
ORDER BY date_trunc('day'::text, ((('now'::text)::date - days_ago.days_ago))::timestamp with time zone) DESC;
|
1550
|
+
|
1551
|
+
|
1552
|
+
--
|
1553
|
+
-- Name: skr_so_details; Type: VIEW; Schema: public; Owner: -
|
1300
1554
|
--
|
1301
1555
|
|
1302
|
-
CREATE VIEW
|
1303
|
-
SELECT so.id AS
|
1556
|
+
CREATE VIEW skr_so_details AS
|
1557
|
+
SELECT so.id AS skr_sales_order_id,
|
1304
1558
|
to_char((so.order_date)::timestamp with time zone, 'YYYY-MM-DD'::text) AS string_order_date,
|
1305
1559
|
cust.code AS customer_code,
|
1306
1560
|
cust.name AS customer_name,
|
1307
1561
|
addr.name AS bill_addr_name,
|
1308
|
-
COALESCE(ttls.total, 0.0) AS
|
1562
|
+
COALESCE(ttls.total, 0.0) AS order_total,
|
1309
1563
|
COALESCE(ttls.num_lines, (0)::bigint) AS num_lines,
|
1310
1564
|
COALESCE(ttls.other_charge_total, (0)::numeric) AS total_other_charge_amount,
|
1311
1565
|
COALESCE(ttls.tax_charge_total, (0)::numeric) AS total_tax_amount,
|
@@ -1315,20 +1569,20 @@ CREATE VIEW skr_so_amount_details AS
|
|
1315
1569
|
JOIN skr_customers cust ON ((cust.id = so.customer_id)))
|
1316
1570
|
JOIN skr_addresses addr ON ((addr.id = so.billing_address_id)))
|
1317
1571
|
LEFT JOIN ( SELECT sol.sales_order_id,
|
1318
|
-
sum((
|
1572
|
+
sum((sol.qty * sol.price)) AS total,
|
1319
1573
|
sum(
|
1320
1574
|
CASE
|
1321
|
-
WHEN s.is_other_charge THEN (
|
1575
|
+
WHEN s.is_other_charge THEN (sol.qty * sol.price)
|
1322
1576
|
ELSE (0)::numeric
|
1323
1577
|
END) AS other_charge_total,
|
1324
1578
|
sum(
|
1325
1579
|
CASE
|
1326
|
-
WHEN ((sol.sku_code)::text = 'SHIP'::text) THEN (
|
1580
|
+
WHEN ((sol.sku_code)::text = 'SHIP'::text) THEN (sol.qty * sol.price)
|
1327
1581
|
ELSE (0)::numeric
|
1328
1582
|
END) AS shipping_charge_total,
|
1329
1583
|
sum(
|
1330
1584
|
CASE
|
1331
|
-
WHEN ((sol.sku_code)::text = 'TAX'::text) THEN (
|
1585
|
+
WHEN ((sol.sku_code)::text = 'TAX'::text) THEN (sol.qty * sol.price)
|
1332
1586
|
ELSE (0)::numeric
|
1333
1587
|
END) AS tax_charge_total,
|
1334
1588
|
count(sol.*) AS num_lines
|
@@ -1339,31 +1593,49 @@ CREATE VIEW skr_so_amount_details AS
|
|
1339
1593
|
|
1340
1594
|
|
1341
1595
|
--
|
1342
|
-
-- Name:
|
1596
|
+
-- Name: skr_so_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1343
1597
|
--
|
1344
1598
|
|
1345
|
-
CREATE
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
FROM (generate_series(0, 120, 1) days_ago(days_ago)
|
1352
|
-
LEFT JOIN ( SELECT count(DISTINCT sol.sales_order_id) AS order_count,
|
1353
|
-
count(*) AS line_count,
|
1354
|
-
sum((sol.price * (sol.qty)::numeric)) AS total,
|
1355
|
-
date_trunc('day'::text, so.created_at) AS so_date
|
1356
|
-
FROM (skr_so_lines sol
|
1357
|
-
JOIN skr_sales_orders so ON ((sol.sales_order_id = so.id)))
|
1358
|
-
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))))
|
1359
|
-
ORDER BY date_trunc('day'::text, ((('now'::text)::date - days_ago.days_ago))::timestamp with time zone) DESC;
|
1599
|
+
CREATE SEQUENCE skr_so_lines_id_seq
|
1600
|
+
START WITH 1
|
1601
|
+
INCREMENT BY 1
|
1602
|
+
NO MINVALUE
|
1603
|
+
NO MAXVALUE
|
1604
|
+
CACHE 1;
|
1360
1605
|
|
1361
1606
|
|
1362
1607
|
--
|
1363
|
-
-- Name: skr_so_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1608
|
+
-- Name: skr_so_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1364
1609
|
--
|
1365
1610
|
|
1366
|
-
|
1611
|
+
ALTER SEQUENCE skr_so_lines_id_seq OWNED BY skr_so_lines.id;
|
1612
|
+
|
1613
|
+
|
1614
|
+
--
|
1615
|
+
-- Name: skr_time_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1616
|
+
--
|
1617
|
+
|
1618
|
+
CREATE TABLE skr_time_entries (
|
1619
|
+
id integer NOT NULL,
|
1620
|
+
customer_project_id integer NOT NULL,
|
1621
|
+
lanes_user_id integer NOT NULL,
|
1622
|
+
is_invoiced boolean DEFAULT false NOT NULL,
|
1623
|
+
options jsonb DEFAULT '{}'::jsonb NOT NULL,
|
1624
|
+
start_at timestamp without time zone NOT NULL,
|
1625
|
+
end_at timestamp without time zone NOT NULL,
|
1626
|
+
description text NOT NULL,
|
1627
|
+
created_at timestamp without time zone NOT NULL,
|
1628
|
+
created_by_id integer NOT NULL,
|
1629
|
+
updated_at timestamp without time zone NOT NULL,
|
1630
|
+
updated_by_id integer NOT NULL
|
1631
|
+
);
|
1632
|
+
|
1633
|
+
|
1634
|
+
--
|
1635
|
+
-- Name: skr_time_entries_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1636
|
+
--
|
1637
|
+
|
1638
|
+
CREATE SEQUENCE skr_time_entries_id_seq
|
1367
1639
|
START WITH 1
|
1368
1640
|
INCREMENT BY 1
|
1369
1641
|
NO MINVALUE
|
@@ -1372,10 +1644,10 @@ CREATE SEQUENCE skr_so_lines_id_seq
|
|
1372
1644
|
|
1373
1645
|
|
1374
1646
|
--
|
1375
|
-
-- Name:
|
1647
|
+
-- Name: skr_time_entries_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1376
1648
|
--
|
1377
1649
|
|
1378
|
-
ALTER SEQUENCE
|
1650
|
+
ALTER SEQUENCE skr_time_entries_id_seq OWNED BY skr_time_entries.id;
|
1379
1651
|
|
1380
1652
|
|
1381
1653
|
--
|
@@ -1465,13 +1737,13 @@ ALTER SEQUENCE skr_vo_lines_id_seq OWNED BY skr_vo_lines.id;
|
|
1465
1737
|
|
1466
1738
|
CREATE TABLE skr_vouchers (
|
1467
1739
|
id integer NOT NULL,
|
1468
|
-
visible_id
|
1740
|
+
visible_id character varying NOT NULL,
|
1741
|
+
state smallint DEFAULT 0 NOT NULL,
|
1469
1742
|
vendor_id integer NOT NULL,
|
1470
1743
|
purchase_order_id integer,
|
1471
1744
|
terms_id integer NOT NULL,
|
1472
|
-
state character varying NOT NULL,
|
1473
|
-
refno character varying,
|
1474
1745
|
confirmation_date date,
|
1746
|
+
refno character varying,
|
1475
1747
|
created_at timestamp without time zone NOT NULL,
|
1476
1748
|
created_by_id integer NOT NULL,
|
1477
1749
|
updated_at timestamp without time zone NOT NULL,
|
@@ -1499,24 +1771,21 @@ ALTER SEQUENCE skr_vouchers_id_seq OWNED BY skr_vouchers.id;
|
|
1499
1771
|
|
1500
1772
|
|
1501
1773
|
--
|
1502
|
-
-- Name:
|
1774
|
+
-- Name: system_settings; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1503
1775
|
--
|
1504
1776
|
|
1505
|
-
CREATE TABLE
|
1777
|
+
CREATE TABLE system_settings (
|
1506
1778
|
id integer NOT NULL,
|
1507
|
-
|
1508
|
-
|
1509
|
-
visits text[] DEFAULT '{}'::text[],
|
1510
|
-
created_at timestamp without time zone NOT NULL,
|
1511
|
-
updated_at timestamp without time zone NOT NULL
|
1779
|
+
logo character varying,
|
1780
|
+
settings jsonb DEFAULT '{}'::jsonb NOT NULL
|
1512
1781
|
);
|
1513
1782
|
|
1514
1783
|
|
1515
1784
|
--
|
1516
|
-
-- Name:
|
1785
|
+
-- Name: system_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1517
1786
|
--
|
1518
1787
|
|
1519
|
-
CREATE SEQUENCE
|
1788
|
+
CREATE SEQUENCE system_settings_id_seq
|
1520
1789
|
START WITH 1
|
1521
1790
|
INCREMENT BY 1
|
1522
1791
|
NO MINVALUE
|
@@ -1525,10 +1794,10 @@ CREATE SEQUENCE testers_id_seq
|
|
1525
1794
|
|
1526
1795
|
|
1527
1796
|
--
|
1528
|
-
-- Name:
|
1797
|
+
-- Name: system_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1529
1798
|
--
|
1530
1799
|
|
1531
|
-
ALTER SEQUENCE
|
1800
|
+
ALTER SEQUENCE system_settings_id_seq OWNED BY system_settings.id;
|
1532
1801
|
|
1533
1802
|
|
1534
1803
|
--
|
@@ -1545,6 +1814,20 @@ ALTER TABLE ONLY lanes_users ALTER COLUMN id SET DEFAULT nextval('lanes_users_id
|
|
1545
1814
|
ALTER TABLE ONLY skr_addresses ALTER COLUMN id SET DEFAULT nextval('skr_addresses_id_seq'::regclass);
|
1546
1815
|
|
1547
1816
|
|
1817
|
+
--
|
1818
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1819
|
+
--
|
1820
|
+
|
1821
|
+
ALTER TABLE ONLY skr_bank_accounts ALTER COLUMN id SET DEFAULT nextval('skr_bank_accounts_id_seq'::regclass);
|
1822
|
+
|
1823
|
+
|
1824
|
+
--
|
1825
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1826
|
+
--
|
1827
|
+
|
1828
|
+
ALTER TABLE ONLY skr_customer_projects ALTER COLUMN id SET DEFAULT nextval('skr_customer_projects_id_seq'::regclass);
|
1829
|
+
|
1830
|
+
|
1548
1831
|
--
|
1549
1832
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1550
1833
|
--
|
@@ -1629,6 +1912,13 @@ ALTER TABLE ONLY skr_invoices ALTER COLUMN id SET DEFAULT nextval('skr_invoices_
|
|
1629
1912
|
ALTER TABLE ONLY skr_locations ALTER COLUMN id SET DEFAULT nextval('skr_locations_id_seq'::regclass);
|
1630
1913
|
|
1631
1914
|
|
1915
|
+
--
|
1916
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1917
|
+
--
|
1918
|
+
|
1919
|
+
ALTER TABLE ONLY skr_payment_categories ALTER COLUMN id SET DEFAULT nextval('skr_payment_categories_id_seq'::regclass);
|
1920
|
+
|
1921
|
+
|
1632
1922
|
--
|
1633
1923
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1634
1924
|
--
|
@@ -1636,6 +1926,13 @@ ALTER TABLE ONLY skr_locations ALTER COLUMN id SET DEFAULT nextval('skr_location
|
|
1636
1926
|
ALTER TABLE ONLY skr_payment_terms ALTER COLUMN id SET DEFAULT nextval('skr_payment_terms_id_seq'::regclass);
|
1637
1927
|
|
1638
1928
|
|
1929
|
+
--
|
1930
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1931
|
+
--
|
1932
|
+
|
1933
|
+
ALTER TABLE ONLY skr_payments ALTER COLUMN id SET DEFAULT nextval('skr_payments_id_seq'::regclass);
|
1934
|
+
|
1935
|
+
|
1639
1936
|
--
|
1640
1937
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1641
1938
|
--
|
@@ -1720,6 +2017,13 @@ ALTER TABLE ONLY skr_skus ALTER COLUMN id SET DEFAULT nextval('skr_skus_id_seq':
|
|
1720
2017
|
ALTER TABLE ONLY skr_so_lines ALTER COLUMN id SET DEFAULT nextval('skr_so_lines_id_seq'::regclass);
|
1721
2018
|
|
1722
2019
|
|
2020
|
+
--
|
2021
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
2022
|
+
--
|
2023
|
+
|
2024
|
+
ALTER TABLE ONLY skr_time_entries ALTER COLUMN id SET DEFAULT nextval('skr_time_entries_id_seq'::regclass);
|
2025
|
+
|
2026
|
+
|
1723
2027
|
--
|
1724
2028
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1725
2029
|
--
|
@@ -1752,7 +2056,7 @@ ALTER TABLE ONLY skr_vouchers ALTER COLUMN id SET DEFAULT nextval('skr_vouchers_
|
|
1752
2056
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1753
2057
|
--
|
1754
2058
|
|
1755
|
-
ALTER TABLE ONLY
|
2059
|
+
ALTER TABLE ONLY system_settings ALTER COLUMN id SET DEFAULT nextval('system_settings_id_seq'::regclass);
|
1756
2060
|
|
1757
2061
|
|
1758
2062
|
--
|
@@ -1771,6 +2075,22 @@ ALTER TABLE ONLY skr_addresses
|
|
1771
2075
|
ADD CONSTRAINT skr_addresses_pkey PRIMARY KEY (id);
|
1772
2076
|
|
1773
2077
|
|
2078
|
+
--
|
2079
|
+
-- Name: skr_bank_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2080
|
+
--
|
2081
|
+
|
2082
|
+
ALTER TABLE ONLY skr_bank_accounts
|
2083
|
+
ADD CONSTRAINT skr_bank_accounts_pkey PRIMARY KEY (id);
|
2084
|
+
|
2085
|
+
|
2086
|
+
--
|
2087
|
+
-- Name: skr_customer_projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2088
|
+
--
|
2089
|
+
|
2090
|
+
ALTER TABLE ONLY skr_customer_projects
|
2091
|
+
ADD CONSTRAINT skr_customer_projects_pkey PRIMARY KEY (id);
|
2092
|
+
|
2093
|
+
|
1774
2094
|
--
|
1775
2095
|
-- Name: skr_customers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1776
2096
|
--
|
@@ -1867,6 +2187,14 @@ ALTER TABLE ONLY skr_locations
|
|
1867
2187
|
ADD CONSTRAINT skr_locations_pkey PRIMARY KEY (id);
|
1868
2188
|
|
1869
2189
|
|
2190
|
+
--
|
2191
|
+
-- Name: skr_payment_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2192
|
+
--
|
2193
|
+
|
2194
|
+
ALTER TABLE ONLY skr_payment_categories
|
2195
|
+
ADD CONSTRAINT skr_payment_categories_pkey PRIMARY KEY (id);
|
2196
|
+
|
2197
|
+
|
1870
2198
|
--
|
1871
2199
|
-- Name: skr_payment_terms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1872
2200
|
--
|
@@ -1875,6 +2203,14 @@ ALTER TABLE ONLY skr_payment_terms
|
|
1875
2203
|
ADD CONSTRAINT skr_payment_terms_pkey PRIMARY KEY (id);
|
1876
2204
|
|
1877
2205
|
|
2206
|
+
--
|
2207
|
+
-- Name: skr_payments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2208
|
+
--
|
2209
|
+
|
2210
|
+
ALTER TABLE ONLY skr_payments
|
2211
|
+
ADD CONSTRAINT skr_payments_pkey PRIMARY KEY (id);
|
2212
|
+
|
2213
|
+
|
1878
2214
|
--
|
1879
2215
|
-- Name: skr_pick_tickets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1880
2216
|
--
|
@@ -1979,6 +2315,14 @@ ALTER TABLE ONLY skr_so_lines
|
|
1979
2315
|
ADD CONSTRAINT skr_so_lines_pkey PRIMARY KEY (id);
|
1980
2316
|
|
1981
2317
|
|
2318
|
+
--
|
2319
|
+
-- Name: skr_time_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2320
|
+
--
|
2321
|
+
|
2322
|
+
ALTER TABLE ONLY skr_time_entries
|
2323
|
+
ADD CONSTRAINT skr_time_entries_pkey PRIMARY KEY (id);
|
2324
|
+
|
2325
|
+
|
1982
2326
|
--
|
1983
2327
|
-- Name: skr_uoms_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
1984
2328
|
--
|
@@ -2012,11 +2356,11 @@ ALTER TABLE ONLY skr_vouchers
|
|
2012
2356
|
|
2013
2357
|
|
2014
2358
|
--
|
2015
|
-
-- Name:
|
2359
|
+
-- Name: system_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2016
2360
|
--
|
2017
2361
|
|
2018
|
-
ALTER TABLE ONLY
|
2019
|
-
ADD CONSTRAINT
|
2362
|
+
ALTER TABLE ONLY system_settings
|
2363
|
+
ADD CONSTRAINT system_settings_pkey PRIMARY KEY (id);
|
2020
2364
|
|
2021
2365
|
|
2022
2366
|
--
|
@@ -2026,6 +2370,13 @@ ALTER TABLE ONLY testers
|
|
2026
2370
|
CREATE INDEX index_lanes_users_on_role_names ON lanes_users USING gin (role_names);
|
2027
2371
|
|
2028
2372
|
|
2373
|
+
--
|
2374
|
+
-- Name: index_skr_customer_projects_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2375
|
+
--
|
2376
|
+
|
2377
|
+
CREATE INDEX index_skr_customer_projects_on_code ON skr_customer_projects USING btree (code);
|
2378
|
+
|
2379
|
+
|
2029
2380
|
--
|
2030
2381
|
-- Name: index_skr_customers_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2031
2382
|
--
|
@@ -2033,6 +2384,13 @@ CREATE INDEX index_lanes_users_on_role_names ON lanes_users USING gin (role_name
|
|
2033
2384
|
CREATE INDEX index_skr_customers_on_code ON skr_customers USING btree (code);
|
2034
2385
|
|
2035
2386
|
|
2387
|
+
--
|
2388
|
+
-- Name: index_skr_gl_manual_entries_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2389
|
+
--
|
2390
|
+
|
2391
|
+
CREATE INDEX index_skr_gl_manual_entries_on_visible_id ON skr_gl_manual_entries USING btree (visible_id);
|
2392
|
+
|
2393
|
+
|
2036
2394
|
--
|
2037
2395
|
-- Name: index_skr_gl_postings_on_period_and_year_and_account_number; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2038
2396
|
--
|
@@ -2040,6 +2398,20 @@ CREATE INDEX index_skr_customers_on_code ON skr_customers USING btree (code);
|
|
2040
2398
|
CREATE INDEX index_skr_gl_postings_on_period_and_year_and_account_number ON skr_gl_postings USING btree (period, year, account_number);
|
2041
2399
|
|
2042
2400
|
|
2401
|
+
--
|
2402
|
+
-- Name: index_skr_inventory_adjustments_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2403
|
+
--
|
2404
|
+
|
2405
|
+
CREATE INDEX index_skr_inventory_adjustments_on_visible_id ON skr_inventory_adjustments USING btree (visible_id);
|
2406
|
+
|
2407
|
+
|
2408
|
+
--
|
2409
|
+
-- Name: index_skr_invoices_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2410
|
+
--
|
2411
|
+
|
2412
|
+
CREATE INDEX index_skr_invoices_on_visible_id ON skr_invoices USING btree (visible_id);
|
2413
|
+
|
2414
|
+
|
2043
2415
|
--
|
2044
2416
|
-- Name: index_skr_locations_on_code; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2045
2417
|
--
|
@@ -2055,66 +2427,113 @@ CREATE INDEX index_skr_payment_terms_on_code ON skr_payment_terms USING btree (c
|
|
2055
2427
|
|
2056
2428
|
|
2057
2429
|
--
|
2058
|
-
-- Name:
|
2430
|
+
-- Name: index_skr_payments_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2059
2431
|
--
|
2060
2432
|
|
2061
|
-
CREATE INDEX
|
2433
|
+
CREATE INDEX index_skr_payments_on_visible_id ON skr_payments USING btree (visible_id);
|
2062
2434
|
|
2063
2435
|
|
2064
2436
|
--
|
2065
|
-
-- Name:
|
2437
|
+
-- Name: index_skr_pick_tickets_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2066
2438
|
--
|
2067
2439
|
|
2068
|
-
CREATE INDEX
|
2440
|
+
CREATE INDEX index_skr_pick_tickets_on_visible_id ON skr_pick_tickets USING btree (visible_id);
|
2069
2441
|
|
2070
2442
|
|
2071
2443
|
--
|
2072
|
-
-- Name:
|
2444
|
+
-- Name: index_skr_po_receipts_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2073
2445
|
--
|
2074
2446
|
|
2075
|
-
CREATE INDEX
|
2447
|
+
CREATE INDEX index_skr_po_receipts_on_visible_id ON skr_po_receipts USING btree (visible_id);
|
2076
2448
|
|
2077
2449
|
|
2078
2450
|
--
|
2079
|
-
-- Name:
|
2451
|
+
-- Name: index_skr_purchase_orders_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2080
2452
|
--
|
2081
2453
|
|
2082
|
-
CREATE INDEX
|
2454
|
+
CREATE INDEX index_skr_purchase_orders_on_visible_id ON skr_purchase_orders USING btree (visible_id);
|
2083
2455
|
|
2084
2456
|
|
2085
2457
|
--
|
2086
|
-
-- Name:
|
2458
|
+
-- Name: index_skr_sales_orders_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2087
2459
|
--
|
2088
2460
|
|
2089
|
-
CREATE INDEX
|
2461
|
+
CREATE INDEX index_skr_sales_orders_on_visible_id ON skr_sales_orders USING btree (visible_id);
|
2090
2462
|
|
2091
2463
|
|
2092
2464
|
--
|
2093
|
-
-- Name:
|
2465
|
+
-- Name: index_skr_time_entries_on_lanes_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2094
2466
|
--
|
2095
2467
|
|
2096
|
-
CREATE INDEX
|
2468
|
+
CREATE INDEX index_skr_time_entries_on_lanes_user_id ON skr_time_entries USING btree (lanes_user_id);
|
2097
2469
|
|
2098
2470
|
|
2099
2471
|
--
|
2100
|
-
-- Name:
|
2472
|
+
-- Name: index_skr_vouchers_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2101
2473
|
--
|
2102
2474
|
|
2103
|
-
CREATE INDEX
|
2475
|
+
CREATE INDEX index_skr_vouchers_on_visible_id ON skr_vouchers USING btree (visible_id);
|
2104
2476
|
|
2105
2477
|
|
2106
2478
|
--
|
2107
|
-
-- Name:
|
2479
|
+
-- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2108
2480
|
--
|
2109
2481
|
|
2110
|
-
CREATE INDEX
|
2482
|
+
CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);
|
2111
2483
|
|
2112
2484
|
|
2113
2485
|
--
|
2114
|
-
-- Name:
|
2486
|
+
-- Name: _RETURN; Type: RULE; Schema: public; Owner: -
|
2115
2487
|
--
|
2116
2488
|
|
2117
|
-
CREATE
|
2489
|
+
CREATE RULE "_RETURN" AS
|
2490
|
+
ON SELECT TO skr_gl_account_balances DO INSTEAD SELECT gla.id AS skr_gl_account_id,
|
2491
|
+
"right"((glp.account_number)::text, 2) AS branch_number,
|
2492
|
+
COALESCE(sum(glp.amount), 0.00) AS balance
|
2493
|
+
FROM (skr_gl_accounts gla
|
2494
|
+
LEFT JOIN skr_gl_postings glp ON (("left"((glp.account_number)::text, 4) = (gla.number)::text)))
|
2495
|
+
GROUP BY gla.id, "right"((glp.account_number)::text, 2)
|
2496
|
+
ORDER BY gla.number;
|
2497
|
+
|
2498
|
+
|
2499
|
+
--
|
2500
|
+
-- Name: fk_rails_a04e857496; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2501
|
+
--
|
2502
|
+
|
2503
|
+
ALTER TABLE ONLY skr_time_entries
|
2504
|
+
ADD CONSTRAINT fk_rails_a04e857496 FOREIGN KEY (lanes_user_id) REFERENCES lanes_users(id);
|
2505
|
+
|
2506
|
+
|
2507
|
+
--
|
2508
|
+
-- Name: skr_bank_accounts_address_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2509
|
+
--
|
2510
|
+
|
2511
|
+
ALTER TABLE ONLY skr_bank_accounts
|
2512
|
+
ADD CONSTRAINT skr_bank_accounts_address_id_fk FOREIGN KEY (address_id) REFERENCES skr_addresses(id);
|
2513
|
+
|
2514
|
+
|
2515
|
+
--
|
2516
|
+
-- Name: skr_bank_accounts_gl_account_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2517
|
+
--
|
2518
|
+
|
2519
|
+
ALTER TABLE ONLY skr_bank_accounts
|
2520
|
+
ADD CONSTRAINT skr_bank_accounts_gl_account_id_fk FOREIGN KEY (gl_account_id) REFERENCES skr_gl_accounts(id);
|
2521
|
+
|
2522
|
+
|
2523
|
+
--
|
2524
|
+
-- Name: skr_customer_projects_customer_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2525
|
+
--
|
2526
|
+
|
2527
|
+
ALTER TABLE ONLY skr_customer_projects
|
2528
|
+
ADD CONSTRAINT skr_customer_projects_customer_id_fk FOREIGN KEY (customer_id) REFERENCES skr_customers(id);
|
2529
|
+
|
2530
|
+
|
2531
|
+
--
|
2532
|
+
-- Name: skr_customer_projects_sku_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2533
|
+
--
|
2534
|
+
|
2535
|
+
ALTER TABLE ONLY skr_customer_projects
|
2536
|
+
ADD CONSTRAINT skr_customer_projects_sku_id_fk FOREIGN KEY (sku_id) REFERENCES skr_skus(id);
|
2118
2537
|
|
2119
2538
|
|
2120
2539
|
--
|
@@ -2213,6 +2632,14 @@ ALTER TABLE ONLY skr_inv_lines
|
|
2213
2632
|
ADD CONSTRAINT skr_inv_lines_so_line_id_fk FOREIGN KEY (so_line_id) REFERENCES skr_so_lines(id);
|
2214
2633
|
|
2215
2634
|
|
2635
|
+
--
|
2636
|
+
-- Name: skr_inv_lines_time_entry_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2637
|
+
--
|
2638
|
+
|
2639
|
+
ALTER TABLE ONLY skr_inv_lines
|
2640
|
+
ADD CONSTRAINT skr_inv_lines_time_entry_id_fk FOREIGN KEY (time_entry_id) REFERENCES skr_time_entries(id);
|
2641
|
+
|
2642
|
+
|
2216
2643
|
--
|
2217
2644
|
-- Name: skr_inventory_adjustments_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2218
2645
|
--
|
@@ -2245,6 +2672,14 @@ ALTER TABLE ONLY skr_invoices
|
|
2245
2672
|
ADD CONSTRAINT skr_invoices_customer_id_fk FOREIGN KEY (customer_id) REFERENCES skr_customers(id);
|
2246
2673
|
|
2247
2674
|
|
2675
|
+
--
|
2676
|
+
-- Name: skr_invoices_customer_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2677
|
+
--
|
2678
|
+
|
2679
|
+
ALTER TABLE ONLY skr_invoices
|
2680
|
+
ADD CONSTRAINT skr_invoices_customer_project_id_fk FOREIGN KEY (customer_project_id) REFERENCES skr_customer_projects(id);
|
2681
|
+
|
2682
|
+
|
2248
2683
|
--
|
2249
2684
|
-- Name: skr_invoices_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2250
2685
|
--
|
@@ -2285,6 +2720,46 @@ ALTER TABLE ONLY skr_locations
|
|
2285
2720
|
ADD CONSTRAINT skr_locations_address_id_fk FOREIGN KEY (address_id) REFERENCES skr_addresses(id);
|
2286
2721
|
|
2287
2722
|
|
2723
|
+
--
|
2724
|
+
-- Name: skr_payment_categories_gl_account_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2725
|
+
--
|
2726
|
+
|
2727
|
+
ALTER TABLE ONLY skr_payment_categories
|
2728
|
+
ADD CONSTRAINT skr_payment_categories_gl_account_id_fk FOREIGN KEY (gl_account_id) REFERENCES skr_gl_accounts(id);
|
2729
|
+
|
2730
|
+
|
2731
|
+
--
|
2732
|
+
-- Name: skr_payments_bank_account_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2733
|
+
--
|
2734
|
+
|
2735
|
+
ALTER TABLE ONLY skr_payments
|
2736
|
+
ADD CONSTRAINT skr_payments_bank_account_id_fk FOREIGN KEY (bank_account_id) REFERENCES skr_bank_accounts(id);
|
2737
|
+
|
2738
|
+
|
2739
|
+
--
|
2740
|
+
-- Name: skr_payments_category_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2741
|
+
--
|
2742
|
+
|
2743
|
+
ALTER TABLE ONLY skr_payments
|
2744
|
+
ADD CONSTRAINT skr_payments_category_id_fk FOREIGN KEY (category_id) REFERENCES skr_payment_categories(id);
|
2745
|
+
|
2746
|
+
|
2747
|
+
--
|
2748
|
+
-- Name: skr_payments_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2749
|
+
--
|
2750
|
+
|
2751
|
+
ALTER TABLE ONLY skr_payments
|
2752
|
+
ADD CONSTRAINT skr_payments_location_id_fk FOREIGN KEY (location_id) REFERENCES skr_locations(id);
|
2753
|
+
|
2754
|
+
|
2755
|
+
--
|
2756
|
+
-- Name: skr_payments_vendor_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2757
|
+
--
|
2758
|
+
|
2759
|
+
ALTER TABLE ONLY skr_payments
|
2760
|
+
ADD CONSTRAINT skr_payments_vendor_id_fk FOREIGN KEY (vendor_id) REFERENCES skr_vendors(id);
|
2761
|
+
|
2762
|
+
|
2288
2763
|
--
|
2289
2764
|
-- Name: skr_pick_tickets_location_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2290
2765
|
--
|
@@ -2549,6 +3024,14 @@ ALTER TABLE ONLY skr_so_lines
|
|
2549
3024
|
ADD CONSTRAINT skr_so_lines_sku_loc_id_fk FOREIGN KEY (sku_loc_id) REFERENCES skr_sku_locs(id);
|
2550
3025
|
|
2551
3026
|
|
3027
|
+
--
|
3028
|
+
-- Name: skr_time_entries_customer_project_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
3029
|
+
--
|
3030
|
+
|
3031
|
+
ALTER TABLE ONLY skr_time_entries
|
3032
|
+
ADD CONSTRAINT skr_time_entries_customer_project_id_fk FOREIGN KEY (customer_project_id) REFERENCES skr_customer_projects(id);
|
3033
|
+
|
3034
|
+
|
2552
3035
|
--
|
2553
3036
|
-- Name: skr_uoms_sku_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: -
|
2554
3037
|
--
|
@@ -2635,6 +3118,8 @@ ALTER TABLE ONLY skr_vouchers
|
|
2635
3118
|
|
2636
3119
|
SET search_path TO "$user",public;
|
2637
3120
|
|
3121
|
+
INSERT INTO schema_migrations (version) VALUES ('1');
|
3122
|
+
|
2638
3123
|
INSERT INTO schema_migrations (version) VALUES ('20120110142845');
|
2639
3124
|
|
2640
3125
|
INSERT INTO schema_migrations (version) VALUES ('20140202185309');
|
@@ -2647,6 +3132,8 @@ INSERT INTO schema_migrations (version) VALUES ('20140202193319');
|
|
2647
3132
|
|
2648
3133
|
INSERT INTO schema_migrations (version) VALUES ('20140202193700');
|
2649
3134
|
|
3135
|
+
INSERT INTO schema_migrations (version) VALUES ('20140202194700');
|
3136
|
+
|
2650
3137
|
INSERT INTO schema_migrations (version) VALUES ('20140213040608');
|
2651
3138
|
|
2652
3139
|
INSERT INTO schema_migrations (version) VALUES ('20140220031700');
|
@@ -2687,6 +3174,10 @@ INSERT INTO schema_migrations (version) VALUES ('20140327202207');
|
|
2687
3174
|
|
2688
3175
|
INSERT INTO schema_migrations (version) VALUES ('20140327202209');
|
2689
3176
|
|
3177
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327214000');
|
3178
|
+
|
3179
|
+
INSERT INTO schema_migrations (version) VALUES ('20140327223002');
|
3180
|
+
|
2690
3181
|
INSERT INTO schema_migrations (version) VALUES ('20140327224000');
|
2691
3182
|
|
2692
3183
|
INSERT INTO schema_migrations (version) VALUES ('20140327224002');
|
@@ -2707,5 +3198,13 @@ INSERT INTO schema_migrations (version) VALUES ('20140422024010');
|
|
2707
3198
|
|
2708
3199
|
INSERT INTO schema_migrations (version) VALUES ('20140615031600');
|
2709
3200
|
|
2710
|
-
INSERT INTO schema_migrations (version) VALUES ('
|
3201
|
+
INSERT INTO schema_migrations (version) VALUES ('20151121211323');
|
3202
|
+
|
3203
|
+
INSERT INTO schema_migrations (version) VALUES ('20160216142845');
|
3204
|
+
|
3205
|
+
INSERT INTO schema_migrations (version) VALUES ('20160229002044');
|
3206
|
+
|
3207
|
+
INSERT INTO schema_migrations (version) VALUES ('20160229041711');
|
3208
|
+
|
3209
|
+
INSERT INTO schema_migrations (version) VALUES ('20160307022705');
|
2711
3210
|
|