stockor 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +15 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +97 -193
- data/client/skr/Extension.coffee +8 -4
- data/client/skr/api.js +21 -0
- data/client/skr/api.scss +148 -0
- data/client/skr/api/Components/AddressForm.cjsx +47 -0
- data/client/skr/api/Components/Base.coffee +7 -0
- data/client/skr/api/Components/SaleHistory.cjsx +32 -0
- data/client/skr/api/Components/SingleItemCart.cjsx +30 -0
- data/client/skr/api/Models/Base.coffee +10 -0
- data/client/skr/api/Models/Cart.coffee +40 -0
- data/client/skr/api/Models/Sale.coffee +43 -0
- data/client/skr/api/Models/SalesHistory.coffee +17 -0
- data/client/skr/api/Models/Sku.coffee +16 -0
- data/client/skr/api/SingleItemCheckout.cjsx +99 -0
- data/client/skr/api/namespace.js +6 -0
- data/client/skr/api/onReady.coffee +23 -0
- data/client/skr/components/CreditCardForm.cjsx +35 -0
- data/client/skr/components/CustomerFinder.cjsx +0 -3
- data/client/skr/components/InvoiceFinder.cjsx +1 -0
- data/client/skr/components/LatexSnippets.cjsx +65 -0
- data/client/skr/components/LocationChooser.cjsx +5 -1
- data/client/skr/components/PrintButton.cjsx +33 -0
- data/client/skr/components/PrintFormChooser.cjsx +10 -10
- data/client/skr/components/SalesOrderFinder.cjsx +2 -1
- data/client/skr/components/SystemSettings.cjsx +69 -9
- data/client/skr/components/address/index.js +1 -0
- data/client/skr/models/Address.coffee +3 -0
- data/client/skr/models/CreditCard.coffee +49 -0
- data/client/skr/models/CreditCardGateway.coffee +27 -0
- data/client/skr/models/Invoice.coffee +13 -5
- data/client/skr/models/Location.coffee +6 -4
- data/client/skr/models/Payment.coffee +33 -13
- data/client/skr/models/SalesOrder.coffee +7 -3
- data/client/skr/models/SequentialId.coffee +17 -0
- data/client/skr/models/Sku.coffee +1 -1
- data/client/skr/models/TimeEntry.coffee +3 -4
- data/client/skr/models/mixins/PrintSupport.coffee +4 -1
- data/client/skr/models/mixins/SkuLine.coffee +1 -1
- data/client/skr/screens/customer-maint/CustomerMaint.cjsx +1 -2
- data/client/skr/screens/customer-projects/CustomerProjects.cjsx +7 -3
- data/client/skr/screens/customer-projects/index.scss +1 -0
- data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +1 -1
- data/client/skr/screens/gl-accounts/GlAccounts.cjsx +1 -1
- data/client/skr/screens/gl-transactions/GlTransactions.cjsx +1 -1
- data/client/skr/screens/invoice/Invoice.cjsx +9 -17
- data/client/skr/screens/invoice/Payment.cjsx +94 -13
- data/client/skr/screens/invoice/index.scss +32 -0
- data/client/skr/screens/locations/Locations.cjsx +3 -2
- data/client/skr/screens/payment-category/PaymentCategory.cjsx +1 -1
- data/client/skr/screens/payments/Payments.cjsx +5 -4
- data/client/skr/screens/sale-report/SaleReport.cjsx +73 -0
- data/client/skr/screens/sale-report/index.js +5 -0
- data/client/skr/screens/sale-report/index.scss +9 -0
- data/client/skr/screens/sales-order/SalesOrder.cjsx +4 -4
- data/client/skr/screens/sku-maint/SkuMaint.cjsx +5 -0
- data/client/skr/screens/sku-maint/SkuUomList.cjsx +45 -56
- data/client/skr/screens/sku-maint/index.scss +33 -13
- data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +2 -2
- data/client/skr/screens/time-tracking/EditEntry.cjsx +2 -4
- data/client/skr/screens/time-tracking/TimeTracking.cjsx +1 -1
- data/client/skr/screens/vendor-maint/VendorMaint.cjsx +1 -1
- data/client/skr/vendor/index.js +2438 -0
- data/config/lanes.rb +10 -3
- data/config/routes.rb +9 -7
- data/config/screens.rb +39 -13
- data/db/migrate/20160517032350_create_remove_location_logos.rb +11 -0
- data/db/migrate/20160531014306_create_public_skus.rb +7 -0
- data/db/migrate/20160604195848_create_null_addresses.rb +9 -0
- data/db/migrate/20160605024432_create_sku_associations_views.rb +48 -0
- data/db/migrate/20160608023553_create_invoice_payments.rb +9 -0
- data/db/migrate/20160620010455_add_payments_to_inv_details.rb +54 -0
- data/db/schema.sql +206 -38
- data/db/seed.rb +6 -0
- data/lib/skr.rb +1 -1
- data/lib/skr/access_roles.rb +6 -1
- data/lib/skr/concerns/has_gl_transaction.rb +8 -0
- data/lib/skr/concerns/inv_extensions.rb +11 -0
- data/lib/skr/concerns/is_order_like.rb +3 -3
- data/lib/skr/concerns/visible_id_identifier.rb +3 -8
- data/lib/skr/configuration.rb +2 -0
- data/lib/skr/extension.rb +6 -0
- data/lib/skr/handlers/credit_card_gateway.rb +31 -0
- data/lib/skr/handlers/invoice_from_time_entries.rb +12 -26
- data/lib/skr/handlers/sales.rb +44 -0
- data/lib/skr/handlers/sequential_ids.rb +46 -0
- data/lib/skr/handlers/skus.rb +36 -0
- data/lib/skr/jobs/fresh_books/import.rb +3 -1
- data/lib/skr/merchant_gateway.rb +37 -0
- data/lib/skr/models/address.rb +7 -5
- data/lib/skr/models/bank_account.rb +12 -0
- data/lib/skr/models/business_entity.rb +1 -1
- data/lib/skr/models/gl_transaction.rb +3 -0
- data/lib/skr/models/inv_line.rb +7 -2
- data/lib/skr/models/inventory_adjustment.rb +0 -5
- data/lib/skr/models/invoice.rb +25 -36
- data/lib/skr/models/location.rb +1 -1
- data/lib/skr/models/payment.rb +56 -10
- data/lib/skr/models/po_receipt.rb +0 -8
- data/lib/skr/models/sales_order.rb +7 -2
- data/lib/skr/models/sequential_id.rb +6 -1
- data/lib/skr/models/sku.rb +3 -0
- data/lib/skr/print.rb +1 -0
- data/lib/skr/print/context.rb +19 -0
- data/lib/skr/print/form.rb +7 -1
- data/lib/skr/version.rb +1 -1
- data/npm-build/package.json +26 -0
- data/npm-build/vendor.js +10 -0
- data/npm-build/webpack.config.js +25 -0
- data/spec/fixtures/skr/bank_account.yml +9 -0
- data/spec/fixtures/skr/customer.yml +10 -0
- data/spec/fixtures/skr/inv_line.yml +12 -0
- data/spec/fixtures/skr/invoice.yml +17 -0
- data/spec/fixtures/skr/payment_category.yml +6 -0
- data/spec/fixtures/skr/sales_order.yml +1 -1
- data/spec/fixtures/skr/sku.yml +10 -0
- data/spec/fixtures/skr/sku_loc.yml +4 -0
- data/spec/fixtures/skr/uom.yml +6 -0
- data/spec/server/handlers/invoice_from_time_entries_spec.rb +13 -6
- data/spec/server/handlers/sequential_ids_spec.rb +22 -0
- data/spec/server/models/invoice_spec.rb +36 -0
- data/spec/server/models/payment_spec.rb +50 -22
- data/spec/server/models/sales_order_spec.rb +12 -0
- data/spec/server/print/form_spec.rb +20 -4
- data/spec/skr/api/SingleItemCheckoutSpec.cjsx +10 -0
- data/spec/skr/screens/sale-report/SaleReportSpec.coffee +5 -0
- data/stockor.gemspec +5 -4
- data/templates/print/layout.tex.erb +1 -1
- data/templates/print/packages/INSTALL +7 -0
- data/templates/print/packages/qrcode.sty +3051 -0
- data/templates/print/packages/svgnam.def +186 -0
- data/templates/print/packages/x11nam.def +352 -0
- data/templates/print/packages/xcolor.pro +58 -0
- data/templates/print/packages/xcolor.sty +1460 -0
- data/templates/print/types/invoice/default.tex.erb +2 -0
- data/templates/print/types/invoice/labor.tex.erb +2 -1
- data/templates/print/types/invoice/ticket.tex.erb +41 -0
- data/templates/print/types/payment/default.tex.erb +13 -12
- metadata +78 -12
data/config/lanes.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
-
# This file will be loaded
|
2
|
-
# one controlling Lanes.
|
1
|
+
# This file will be loaded as part of Lanes startup.
|
3
2
|
#
|
4
|
-
#
|
3
|
+
# Extensions are called in load order, so be aware latter extensions may
|
4
|
+
# override config options specified
|
5
5
|
Lanes.configure do | config |
|
6
6
|
|
7
|
+
|
8
|
+
end
|
9
|
+
|
10
|
+
Lanes.config.get(:environment) do | env |
|
11
|
+
unless Lanes.env.production?
|
12
|
+
ActiveMerchant::Billing::Base.mode = :test
|
13
|
+
end
|
7
14
|
end
|
data/config/routes.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'stockor'
|
2
|
+
require_rel "../lib/skr/handlers/*.rb"
|
2
3
|
|
3
4
|
Lanes::API.routes.for_extension 'skr' do
|
4
5
|
|
@@ -36,9 +37,14 @@ Lanes::API.routes.for_extension 'skr' do
|
|
36
37
|
resources Skr::VoLine
|
37
38
|
resources Skr::SalesOrder
|
38
39
|
resources Skr::SoLine
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
resources Skr::SequentialId, controller: Skr::Handlers::SequentialIds
|
41
|
+
resources Skr::Invoice, controller: Skr::Handlers::InvoiceFromTimeEntries,
|
42
|
+
path: 'invoices/from-time-entries'
|
43
|
+
resources Skr::Sku, path: 'public/skus', controller: Skr::Handlers::Skus, cors: '*', public: true
|
44
|
+
resources Skr::Invoice, path: 'public/sales', controller: Skr::Handlers::Sales, cors: '*', public: true
|
45
|
+
get 'credit-card-gateways.json', &Skr::Handlers::CreditCardGateway.get
|
46
|
+
post 'credit-card-gateways.json', &Skr::Handlers::CreditCardGateway.update
|
47
|
+
post 'fresh-books-imports.json', &Skr::Handlers::FreshBooksImport.handler
|
42
48
|
|
43
49
|
get 'print/:type/:id.pdf' do
|
44
50
|
content_type 'application/pdf'
|
@@ -46,8 +52,4 @@ Lanes::API.routes.for_extension 'skr' do
|
|
46
52
|
form.as_pdf
|
47
53
|
end
|
48
54
|
|
49
|
-
post 'fresh-books-imports.json',
|
50
|
-
&Skr::Handlers::FreshBooksImport.handler
|
51
|
-
|
52
|
-
|
53
55
|
end
|
data/config/screens.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Lanes::Screen.define_group 'accounting' do | group |
|
2
2
|
group.title = "Accounting"
|
3
3
|
group.description = "Accounting functions"
|
4
|
-
group.icon = "
|
4
|
+
group.icon = "balance-scale"
|
5
5
|
end
|
6
6
|
|
7
7
|
Lanes::Screen.define_group 'maint' do | group |
|
@@ -10,6 +10,11 @@ Lanes::Screen.define_group 'maint' do | group |
|
|
10
10
|
group.icon = "pencil-square"
|
11
11
|
end
|
12
12
|
|
13
|
+
Lanes::Screen.define_group 'reports' do | group |
|
14
|
+
group.title = "Reports"
|
15
|
+
group.icon = "file-text-o"
|
16
|
+
end
|
17
|
+
|
13
18
|
Lanes::Screen.define_group 'customer' do | group |
|
14
19
|
group.title = "Customer"
|
15
20
|
group.description = "Customer records"
|
@@ -17,7 +22,9 @@ Lanes::Screen.define_group 'customer' do | group |
|
|
17
22
|
end
|
18
23
|
|
19
24
|
Lanes::Screen.for_extension 'skr' do | screens |
|
20
|
-
|
25
|
+
##################################################################
|
26
|
+
## System Settings ##
|
27
|
+
##################################################################
|
21
28
|
screens.define "locations" do | screen |
|
22
29
|
screen.title = "Locations"
|
23
30
|
screen.description = ""
|
@@ -35,7 +42,9 @@ Lanes::Screen.for_extension 'skr' do | screens |
|
|
35
42
|
screen.view_class = "FreshBooksImport"
|
36
43
|
end
|
37
44
|
|
38
|
-
|
45
|
+
##################################################################
|
46
|
+
## ACCOUNTING GROUP ##
|
47
|
+
##################################################################
|
39
48
|
screens.define "time-invoicing" do | screen |
|
40
49
|
screen.title = "Time Invoicing"
|
41
50
|
screen.description = ""
|
@@ -86,14 +95,6 @@ Lanes::Screen.for_extension 'skr' do | screens |
|
|
86
95
|
screen.model_class = "GlTransaction"
|
87
96
|
screen.view_class = "ChartOfAccounts"
|
88
97
|
end
|
89
|
-
screens.define "gl-transactions" do | screen |
|
90
|
-
screen.title = "Gl Transactions"
|
91
|
-
screen.description = ""
|
92
|
-
screen.icon = "balance-scale"
|
93
|
-
screen.group_id = "accounting"
|
94
|
-
screen.model_class = "GlTransaction"
|
95
|
-
screen.view_class = "GlTransactions"
|
96
|
-
end
|
97
98
|
screens.define "customer-projects" do | screen |
|
98
99
|
screen.title = "Customer Projects"
|
99
100
|
screen.description = ""
|
@@ -113,7 +114,9 @@ Lanes::Screen.for_extension 'skr' do | screens |
|
|
113
114
|
screen.view_class = "GlAccounts"
|
114
115
|
end
|
115
116
|
|
116
|
-
|
117
|
+
##################################################################
|
118
|
+
## MAINT GROUP ##
|
119
|
+
##################################################################
|
117
120
|
screens.define "sku-maint" do | screen |
|
118
121
|
screen.title = "SKU Maintenance"
|
119
122
|
screen.icon = "archive"
|
@@ -136,7 +139,30 @@ Lanes::Screen.for_extension 'skr' do | screens |
|
|
136
139
|
screen.view_class = "VendorMaint"
|
137
140
|
end
|
138
141
|
|
139
|
-
|
142
|
+
##################################################################
|
143
|
+
## REPORTS ##
|
144
|
+
##################################################################
|
145
|
+
screens.define "sale-report" do | screen |
|
146
|
+
screen.title = "Sale Report"
|
147
|
+
screen.description = ""
|
148
|
+
screen.icon = "line-chart"
|
149
|
+
screen.group_id = "reports"
|
150
|
+
screen.model_class = "Invoice"
|
151
|
+
screen.view_class = "SaleReport"
|
152
|
+
end
|
153
|
+
screens.define "gl-transactions" do | screen |
|
154
|
+
screen.title = "Gl Transactions"
|
155
|
+
screen.description = ""
|
156
|
+
screen.icon = "balance-scale"
|
157
|
+
screen.group_id = "accounting"
|
158
|
+
screen.model_class = "GlTransaction"
|
159
|
+
screen.view_class = "GlTransactions"
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
##################################################################
|
164
|
+
## CUSTOMER ##
|
165
|
+
##################################################################
|
140
166
|
screens.define "sales-order" do | screen |
|
141
167
|
screen.title = "Sales Order"
|
142
168
|
screen.description = ""
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class CreateNullAddresses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
%w{ customers vendors invoices sales_orders }.each do | rec |
|
4
|
+
%w{ billing shipping }.each do | col |
|
5
|
+
change_column_null "skr_#{rec}", "#{col}_address_id", :integer, true
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'skr/db/migration_helpers'
|
2
|
+
|
3
|
+
|
4
|
+
## views and indexes to efficiently answer the query "which invoices/orders have item id XXX ?"
|
5
|
+
|
6
|
+
class CreateSkuAssociationsViews < ActiveRecord::Migration
|
7
|
+
|
8
|
+
def up
|
9
|
+
|
10
|
+
add_index(:skr_inv_lines, :sku_loc_id)
|
11
|
+
add_index(:skr_sku_locs, :sku_id)
|
12
|
+
|
13
|
+
execute <<-EOS
|
14
|
+
create view skr_sku_inv_xref as
|
15
|
+
select
|
16
|
+
skr_inv_lines.invoice_id,
|
17
|
+
skr_sku_locs.sku_id
|
18
|
+
from skr_inv_lines
|
19
|
+
join skr_sku_locs on skr_sku_locs.id = skr_inv_lines.sku_loc_id
|
20
|
+
EOS
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
add_index(:skr_so_lines, :sku_loc_id)
|
25
|
+
|
26
|
+
execute <<-EOS
|
27
|
+
create view skr_sku_so_xref as
|
28
|
+
select
|
29
|
+
skr_so_lines.sales_order_id as sales_order_id,
|
30
|
+
skr_sku_locs.sku_id
|
31
|
+
from skr_so_lines
|
32
|
+
join skr_sku_locs on skr_sku_locs.id = skr_so_lines.sku_loc_id
|
33
|
+
EOS
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def down
|
38
|
+
remove_index(:skr_inv_lines, :sku_loc_id)
|
39
|
+
remove_index(:skr_sku_locs, :sku_id)
|
40
|
+
execute "drop view skr_sku_inv_xref"
|
41
|
+
|
42
|
+
remove_index(:skr_so_lines, :sku_loc_id)
|
43
|
+
|
44
|
+
execute "drop view skr_sku_so_xref"
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class CreateInvoicePayments < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :skr_payments, :invoice_id, :integer
|
4
|
+
add_column :skr_payments, :metadata, :jsonb, default: {}
|
5
|
+
remove_column :skr_invoices, :amount_paid, :decimal, precision: 15, scale: 2
|
6
|
+
change_column_null :skr_payments, :category_id, true
|
7
|
+
change_column_null :skr_payments, :check_number, true
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'skr/db/migration_helpers'
|
2
|
+
|
3
|
+
class AddPaymentsToInvDetails < ActiveRecord::Migration
|
4
|
+
|
5
|
+
def view(select = '', join = '')
|
6
|
+
<<-EOS.squish
|
7
|
+
create or replace view #{skr_prefix}inv_details as
|
8
|
+
select
|
9
|
+
inv.id as invoice_id
|
10
|
+
, so.visible_id as sales_order_visible_id
|
11
|
+
, pt.id as pick_ticket_id
|
12
|
+
, to_char(so.created_at,'YYYY-MM-DD') as string_order_date
|
13
|
+
, to_char(inv.created_at,'YYYY-MM-DD') as string_invoice_date
|
14
|
+
, cust.code as customer_code, cust.name as customer_name
|
15
|
+
, ba.name as bill_addr_name
|
16
|
+
, coalesce( ttls.total,0.0 ) as invoice_total
|
17
|
+
, coalesce( ttls.num_lines, 0 ) as num_lines
|
18
|
+
, coalesce( ttls.other_charge_total, 0 ) as total_other_charge_amount
|
19
|
+
, coalesce( ttls.total,0.0 ) - coalesce( ttls.other_charge_total, 0.0 ) as subtotal_amount
|
20
|
+
#{select}
|
21
|
+
from #{skr_prefix}invoices inv
|
22
|
+
join #{skr_prefix}customers cust on cust.id = inv.customer_id
|
23
|
+
left join #{skr_prefix}addresses ba on ba.id = inv.billing_address_id
|
24
|
+
left join #{skr_prefix}sales_orders so on so.id = inv.sales_order_id
|
25
|
+
left join #{skr_prefix}pick_tickets pt on pt.id = inv.pick_ticket_id
|
26
|
+
left join (
|
27
|
+
select
|
28
|
+
invoice_id,
|
29
|
+
sum(ivl.qty*ivl.price) as total,
|
30
|
+
sum( case when s.is_other_charge then ivl.qty*ivl.price else 0 end ) as other_charge_total,
|
31
|
+
count(ivl.*) as num_lines
|
32
|
+
from #{skr_prefix}inv_lines ivl
|
33
|
+
join #{skr_prefix}sku_locs sl on sl.id = ivl.sku_loc_id
|
34
|
+
join #{skr_prefix}skus s on s.id = sl.sku_id
|
35
|
+
group by invoice_id
|
36
|
+
) ttls on ttls.invoice_id = inv.id
|
37
|
+
#{join}
|
38
|
+
EOS
|
39
|
+
end
|
40
|
+
|
41
|
+
def up
|
42
|
+
execute view(", coalesce( payments.amount_paid, 0 ) as amount_paid\n",
|
43
|
+
"left join (
|
44
|
+
select invoice_id, sum(amount) as amount_paid
|
45
|
+
from #{skr_prefix}payments where invoice_id is not NULL group by invoice_id
|
46
|
+
) as payments on payments.invoice_id = inv.id")
|
47
|
+
end
|
48
|
+
|
49
|
+
def down
|
50
|
+
execute "drop view #{skr_prefix}inv_details"
|
51
|
+
execute view
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/db/schema.sql
CHANGED
@@ -65,6 +65,39 @@ SET default_tablespace = '';
|
|
65
65
|
|
66
66
|
SET default_with_oids = false;
|
67
67
|
|
68
|
+
--
|
69
|
+
-- Name: assets; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
70
|
+
--
|
71
|
+
|
72
|
+
CREATE TABLE assets (
|
73
|
+
id integer NOT NULL,
|
74
|
+
file character varying NOT NULL,
|
75
|
+
owner_id integer NOT NULL,
|
76
|
+
owner_type character varying NOT NULL,
|
77
|
+
"order" integer,
|
78
|
+
metadata jsonb DEFAULT '{}'::jsonb NOT NULL
|
79
|
+
);
|
80
|
+
|
81
|
+
|
82
|
+
--
|
83
|
+
-- Name: assets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
84
|
+
--
|
85
|
+
|
86
|
+
CREATE SEQUENCE assets_id_seq
|
87
|
+
START WITH 1
|
88
|
+
INCREMENT BY 1
|
89
|
+
NO MINVALUE
|
90
|
+
NO MAXVALUE
|
91
|
+
CACHE 1;
|
92
|
+
|
93
|
+
|
94
|
+
--
|
95
|
+
-- Name: assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
96
|
+
--
|
97
|
+
|
98
|
+
ALTER SEQUENCE assets_id_seq OWNED BY assets.id;
|
99
|
+
|
100
|
+
|
68
101
|
--
|
69
102
|
-- Name: lanes_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
70
103
|
--
|
@@ -248,8 +281,8 @@ CREATE TABLE skr_customer_projects (
|
|
248
281
|
CREATE TABLE skr_customers (
|
249
282
|
id integer NOT NULL,
|
250
283
|
code character varying NOT NULL,
|
251
|
-
billing_address_id integer
|
252
|
-
shipping_address_id integer
|
284
|
+
billing_address_id integer,
|
285
|
+
shipping_address_id integer,
|
253
286
|
terms_id integer NOT NULL,
|
254
287
|
gl_receivables_account_id integer NOT NULL,
|
255
288
|
credit_limit numeric(15,2) DEFAULT 0.0,
|
@@ -286,7 +319,8 @@ CREATE TABLE skr_skus (
|
|
286
319
|
created_at timestamp without time zone NOT NULL,
|
287
320
|
created_by_id integer NOT NULL,
|
288
321
|
updated_at timestamp without time zone NOT NULL,
|
289
|
-
updated_by_id integer NOT NULL
|
322
|
+
updated_by_id integer NOT NULL,
|
323
|
+
is_public boolean DEFAULT true NOT NULL
|
290
324
|
);
|
291
325
|
|
292
326
|
|
@@ -672,9 +706,8 @@ CREATE TABLE skr_invoices (
|
|
672
706
|
customer_project_id integer,
|
673
707
|
sales_order_id integer,
|
674
708
|
pick_ticket_id integer,
|
675
|
-
shipping_address_id integer
|
676
|
-
billing_address_id integer
|
677
|
-
amount_paid numeric(15,2) DEFAULT 0.0 NOT NULL,
|
709
|
+
shipping_address_id integer,
|
710
|
+
billing_address_id integer,
|
678
711
|
is_tax_exempt boolean DEFAULT false NOT NULL,
|
679
712
|
hash_code character varying NOT NULL,
|
680
713
|
invoice_date date NOT NULL,
|
@@ -689,6 +722,31 @@ CREATE TABLE skr_invoices (
|
|
689
722
|
);
|
690
723
|
|
691
724
|
|
725
|
+
--
|
726
|
+
-- Name: skr_payments; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
727
|
+
--
|
728
|
+
|
729
|
+
CREATE TABLE skr_payments (
|
730
|
+
id integer NOT NULL,
|
731
|
+
visible_id character varying NOT NULL,
|
732
|
+
bank_account_id integer NOT NULL,
|
733
|
+
category_id integer,
|
734
|
+
vendor_id integer,
|
735
|
+
location_id integer NOT NULL,
|
736
|
+
hash_code character varying NOT NULL,
|
737
|
+
amount numeric(15,2) NOT NULL,
|
738
|
+
date date NOT NULL,
|
739
|
+
check_number integer,
|
740
|
+
name text NOT NULL,
|
741
|
+
address text,
|
742
|
+
notes text,
|
743
|
+
created_at timestamp without time zone NOT NULL,
|
744
|
+
updated_at timestamp without time zone NOT NULL,
|
745
|
+
invoice_id integer,
|
746
|
+
metadata jsonb DEFAULT '{}'::jsonb
|
747
|
+
);
|
748
|
+
|
749
|
+
|
692
750
|
--
|
693
751
|
-- Name: skr_pick_tickets; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
694
752
|
--
|
@@ -717,8 +775,8 @@ CREATE TABLE skr_sales_orders (
|
|
717
775
|
state smallint DEFAULT 0 NOT NULL,
|
718
776
|
customer_id integer NOT NULL,
|
719
777
|
location_id integer NOT NULL,
|
720
|
-
shipping_address_id integer
|
721
|
-
billing_address_id integer
|
778
|
+
shipping_address_id integer,
|
779
|
+
billing_address_id integer,
|
722
780
|
terms_id integer NOT NULL,
|
723
781
|
is_tax_exempt boolean DEFAULT false NOT NULL,
|
724
782
|
order_date date NOT NULL,
|
@@ -773,8 +831,9 @@ CREATE VIEW skr_inv_details AS
|
|
773
831
|
COALESCE(ttls.total, 0.0) AS invoice_total,
|
774
832
|
COALESCE(ttls.num_lines, (0)::bigint) AS num_lines,
|
775
833
|
COALESCE(ttls.other_charge_total, (0)::numeric) AS total_other_charge_amount,
|
776
|
-
(COALESCE(ttls.total, 0.0) - COALESCE(ttls.other_charge_total, 0.0)) AS subtotal_amount
|
777
|
-
|
834
|
+
(COALESCE(ttls.total, 0.0) - COALESCE(ttls.other_charge_total, 0.0)) AS subtotal_amount,
|
835
|
+
COALESCE(payments.amount_paid, (0)::numeric) AS amount_paid
|
836
|
+
FROM ((((((skr_invoices inv
|
778
837
|
JOIN skr_customers cust ON ((cust.id = inv.customer_id)))
|
779
838
|
LEFT JOIN skr_addresses ba ON ((ba.id = inv.billing_address_id)))
|
780
839
|
LEFT JOIN skr_sales_orders so ON ((so.id = inv.sales_order_id)))
|
@@ -790,7 +849,12 @@ CREATE VIEW skr_inv_details AS
|
|
790
849
|
FROM ((skr_inv_lines ivl
|
791
850
|
JOIN skr_sku_locs sl ON ((sl.id = ivl.sku_loc_id)))
|
792
851
|
JOIN skr_skus s ON ((s.id = sl.sku_id)))
|
793
|
-
GROUP BY ivl.invoice_id) ttls ON ((ttls.invoice_id = inv.id)))
|
852
|
+
GROUP BY ivl.invoice_id) ttls ON ((ttls.invoice_id = inv.id)))
|
853
|
+
LEFT JOIN ( SELECT skr_payments.invoice_id,
|
854
|
+
sum(skr_payments.amount) AS amount_paid
|
855
|
+
FROM skr_payments
|
856
|
+
WHERE (skr_payments.invoice_id IS NOT NULL)
|
857
|
+
GROUP BY skr_payments.invoice_id) payments ON ((payments.invoice_id = inv.id)));
|
794
858
|
|
795
859
|
|
796
860
|
--
|
@@ -879,7 +943,6 @@ CREATE TABLE skr_locations (
|
|
879
943
|
address_id integer NOT NULL,
|
880
944
|
is_active boolean DEFAULT true NOT NULL,
|
881
945
|
gl_branch_code character varying(2) DEFAULT '01'::character varying NOT NULL,
|
882
|
-
logo character varying,
|
883
946
|
options jsonb,
|
884
947
|
created_at timestamp without time zone NOT NULL,
|
885
948
|
created_by_id integer NOT NULL,
|
@@ -977,29 +1040,6 @@ CREATE SEQUENCE skr_payment_terms_id_seq
|
|
977
1040
|
ALTER SEQUENCE skr_payment_terms_id_seq OWNED BY skr_payment_terms.id;
|
978
1041
|
|
979
1042
|
|
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
1043
|
--
|
1004
1044
|
-- Name: skr_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1005
1045
|
--
|
@@ -1274,6 +1314,17 @@ CREATE TABLE skr_sequential_ids (
|
|
1274
1314
|
);
|
1275
1315
|
|
1276
1316
|
|
1317
|
+
--
|
1318
|
+
-- Name: skr_sku_inv_xref; Type: VIEW; Schema: public; Owner: -
|
1319
|
+
--
|
1320
|
+
|
1321
|
+
CREATE VIEW skr_sku_inv_xref AS
|
1322
|
+
SELECT skr_inv_lines.invoice_id,
|
1323
|
+
skr_sku_locs.sku_id
|
1324
|
+
FROM (skr_inv_lines
|
1325
|
+
JOIN skr_sku_locs ON ((skr_sku_locs.id = skr_inv_lines.sku_loc_id)));
|
1326
|
+
|
1327
|
+
|
1277
1328
|
--
|
1278
1329
|
-- Name: skr_sku_vendors; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1279
1330
|
--
|
@@ -1301,8 +1352,8 @@ CREATE TABLE skr_sku_vendors (
|
|
1301
1352
|
|
1302
1353
|
CREATE TABLE skr_vendors (
|
1303
1354
|
id integer NOT NULL,
|
1304
|
-
billing_address_id integer
|
1305
|
-
shipping_address_id integer
|
1355
|
+
billing_address_id integer,
|
1356
|
+
shipping_address_id integer,
|
1306
1357
|
terms_id integer NOT NULL,
|
1307
1358
|
gl_payables_account_id integer NOT NULL,
|
1308
1359
|
gl_freight_account_id integer NOT NULL,
|
@@ -1420,6 +1471,17 @@ CREATE VIEW skr_sku_qty_details AS
|
|
1420
1471
|
GROUP BY s_1.id) pol_ttl ON ((pol_ttl.sku_id = s.id)));
|
1421
1472
|
|
1422
1473
|
|
1474
|
+
--
|
1475
|
+
-- Name: skr_sku_so_xref; Type: VIEW; Schema: public; Owner: -
|
1476
|
+
--
|
1477
|
+
|
1478
|
+
CREATE VIEW skr_sku_so_xref AS
|
1479
|
+
SELECT skr_so_lines.sales_order_id,
|
1480
|
+
skr_sku_locs.sku_id
|
1481
|
+
FROM (skr_so_lines
|
1482
|
+
JOIN skr_sku_locs ON ((skr_sku_locs.id = skr_so_lines.sku_loc_id)));
|
1483
|
+
|
1484
|
+
|
1423
1485
|
--
|
1424
1486
|
-- Name: skr_sku_trans; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1425
1487
|
--
|
@@ -1776,7 +1838,6 @@ ALTER SEQUENCE skr_vouchers_id_seq OWNED BY skr_vouchers.id;
|
|
1776
1838
|
|
1777
1839
|
CREATE TABLE system_settings (
|
1778
1840
|
id integer NOT NULL,
|
1779
|
-
logo character varying,
|
1780
1841
|
settings jsonb DEFAULT '{}'::jsonb NOT NULL
|
1781
1842
|
);
|
1782
1843
|
|
@@ -1800,6 +1861,46 @@ CREATE SEQUENCE system_settings_id_seq
|
|
1800
1861
|
ALTER SEQUENCE system_settings_id_seq OWNED BY system_settings.id;
|
1801
1862
|
|
1802
1863
|
|
1864
|
+
--
|
1865
|
+
-- Name: testers; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
1866
|
+
--
|
1867
|
+
|
1868
|
+
CREATE TABLE testers (
|
1869
|
+
id integer NOT NULL,
|
1870
|
+
name character varying,
|
1871
|
+
email character varying,
|
1872
|
+
visits text[] DEFAULT '{}'::text[],
|
1873
|
+
created_at timestamp without time zone NOT NULL,
|
1874
|
+
updated_at timestamp without time zone NOT NULL
|
1875
|
+
);
|
1876
|
+
|
1877
|
+
|
1878
|
+
--
|
1879
|
+
-- Name: testers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
1880
|
+
--
|
1881
|
+
|
1882
|
+
CREATE SEQUENCE testers_id_seq
|
1883
|
+
START WITH 1
|
1884
|
+
INCREMENT BY 1
|
1885
|
+
NO MINVALUE
|
1886
|
+
NO MAXVALUE
|
1887
|
+
CACHE 1;
|
1888
|
+
|
1889
|
+
|
1890
|
+
--
|
1891
|
+
-- Name: testers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
1892
|
+
--
|
1893
|
+
|
1894
|
+
ALTER SEQUENCE testers_id_seq OWNED BY testers.id;
|
1895
|
+
|
1896
|
+
|
1897
|
+
--
|
1898
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1899
|
+
--
|
1900
|
+
|
1901
|
+
ALTER TABLE ONLY assets ALTER COLUMN id SET DEFAULT nextval('assets_id_seq'::regclass);
|
1902
|
+
|
1903
|
+
|
1803
1904
|
--
|
1804
1905
|
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
1805
1906
|
--
|
@@ -2059,6 +2160,21 @@ ALTER TABLE ONLY skr_vouchers ALTER COLUMN id SET DEFAULT nextval('skr_vouchers_
|
|
2059
2160
|
ALTER TABLE ONLY system_settings ALTER COLUMN id SET DEFAULT nextval('system_settings_id_seq'::regclass);
|
2060
2161
|
|
2061
2162
|
|
2163
|
+
--
|
2164
|
+
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
|
2165
|
+
--
|
2166
|
+
|
2167
|
+
ALTER TABLE ONLY testers ALTER COLUMN id SET DEFAULT nextval('testers_id_seq'::regclass);
|
2168
|
+
|
2169
|
+
|
2170
|
+
--
|
2171
|
+
-- Name: assets_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2172
|
+
--
|
2173
|
+
|
2174
|
+
ALTER TABLE ONLY assets
|
2175
|
+
ADD CONSTRAINT assets_pkey PRIMARY KEY (id);
|
2176
|
+
|
2177
|
+
|
2062
2178
|
--
|
2063
2179
|
-- Name: lanes_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2064
2180
|
--
|
@@ -2363,6 +2479,21 @@ ALTER TABLE ONLY system_settings
|
|
2363
2479
|
ADD CONSTRAINT system_settings_pkey PRIMARY KEY (id);
|
2364
2480
|
|
2365
2481
|
|
2482
|
+
--
|
2483
|
+
-- Name: testers_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
2484
|
+
--
|
2485
|
+
|
2486
|
+
ALTER TABLE ONLY testers
|
2487
|
+
ADD CONSTRAINT testers_pkey PRIMARY KEY (id);
|
2488
|
+
|
2489
|
+
|
2490
|
+
--
|
2491
|
+
-- Name: index_assets_on_owner_id_and_owner_type; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2492
|
+
--
|
2493
|
+
|
2494
|
+
CREATE INDEX index_assets_on_owner_id_and_owner_type ON assets USING btree (owner_id, owner_type);
|
2495
|
+
|
2496
|
+
|
2366
2497
|
--
|
2367
2498
|
-- Name: index_lanes_users_on_role_names; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2368
2499
|
--
|
@@ -2398,6 +2529,13 @@ CREATE INDEX index_skr_gl_manual_entries_on_visible_id ON skr_gl_manual_entries
|
|
2398
2529
|
CREATE INDEX index_skr_gl_postings_on_period_and_year_and_account_number ON skr_gl_postings USING btree (period, year, account_number);
|
2399
2530
|
|
2400
2531
|
|
2532
|
+
--
|
2533
|
+
-- Name: index_skr_inv_lines_on_sku_loc_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2534
|
+
--
|
2535
|
+
|
2536
|
+
CREATE INDEX index_skr_inv_lines_on_sku_loc_id ON skr_inv_lines USING btree (sku_loc_id);
|
2537
|
+
|
2538
|
+
|
2401
2539
|
--
|
2402
2540
|
-- Name: index_skr_inventory_adjustments_on_visible_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2403
2541
|
--
|
@@ -2461,6 +2599,20 @@ CREATE INDEX index_skr_purchase_orders_on_visible_id ON skr_purchase_orders USIN
|
|
2461
2599
|
CREATE INDEX index_skr_sales_orders_on_visible_id ON skr_sales_orders USING btree (visible_id);
|
2462
2600
|
|
2463
2601
|
|
2602
|
+
--
|
2603
|
+
-- Name: index_skr_sku_locs_on_sku_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2604
|
+
--
|
2605
|
+
|
2606
|
+
CREATE INDEX index_skr_sku_locs_on_sku_id ON skr_sku_locs USING btree (sku_id);
|
2607
|
+
|
2608
|
+
|
2609
|
+
--
|
2610
|
+
-- Name: index_skr_so_lines_on_sku_loc_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2611
|
+
--
|
2612
|
+
|
2613
|
+
CREATE INDEX index_skr_so_lines_on_sku_loc_id ON skr_so_lines USING btree (sku_loc_id);
|
2614
|
+
|
2615
|
+
|
2464
2616
|
--
|
2465
2617
|
-- Name: index_skr_time_entries_on_lanes_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
2466
2618
|
--
|
@@ -3120,6 +3272,8 @@ SET search_path TO "$user",public;
|
|
3120
3272
|
|
3121
3273
|
INSERT INTO schema_migrations (version) VALUES ('1');
|
3122
3274
|
|
3275
|
+
INSERT INTO schema_migrations (version) VALUES ('2');
|
3276
|
+
|
3123
3277
|
INSERT INTO schema_migrations (version) VALUES ('20120110142845');
|
3124
3278
|
|
3125
3279
|
INSERT INTO schema_migrations (version) VALUES ('20140202185309');
|
@@ -3198,6 +3352,8 @@ INSERT INTO schema_migrations (version) VALUES ('20140422024010');
|
|
3198
3352
|
|
3199
3353
|
INSERT INTO schema_migrations (version) VALUES ('20140615031600');
|
3200
3354
|
|
3355
|
+
INSERT INTO schema_migrations (version) VALUES ('20150220015108');
|
3356
|
+
|
3201
3357
|
INSERT INTO schema_migrations (version) VALUES ('20151121211323');
|
3202
3358
|
|
3203
3359
|
INSERT INTO schema_migrations (version) VALUES ('20160216142845');
|
@@ -3208,3 +3364,15 @@ INSERT INTO schema_migrations (version) VALUES ('20160229041711');
|
|
3208
3364
|
|
3209
3365
|
INSERT INTO schema_migrations (version) VALUES ('20160307022705');
|
3210
3366
|
|
3367
|
+
INSERT INTO schema_migrations (version) VALUES ('20160517032350');
|
3368
|
+
|
3369
|
+
INSERT INTO schema_migrations (version) VALUES ('20160531014306');
|
3370
|
+
|
3371
|
+
INSERT INTO schema_migrations (version) VALUES ('20160604195848');
|
3372
|
+
|
3373
|
+
INSERT INTO schema_migrations (version) VALUES ('20160605024432');
|
3374
|
+
|
3375
|
+
INSERT INTO schema_migrations (version) VALUES ('20160608023553');
|
3376
|
+
|
3377
|
+
INSERT INTO schema_migrations (version) VALUES ('20160620010455');
|
3378
|
+
|