stockor 0.1.9 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +254 -72
  4. data/Guardfile +1 -1
  5. data/README.md +24 -3
  6. data/app.json +28 -0
  7. data/client/skr/Extension.coffee +18 -0
  8. data/client/skr/components/BankAccountFinder.cjsx +34 -0
  9. data/client/skr/components/Currency.cjsx +19 -0
  10. data/client/skr/components/CustomerFinder.cjsx +37 -0
  11. data/client/skr/components/CustomerLink.cjsx +13 -0
  12. data/client/skr/components/CustomerProjectFinder.cjsx +49 -0
  13. data/client/skr/components/GlAccountChooser.cjsx +38 -0
  14. data/client/skr/components/InvoiceFinder.cjsx +37 -0
  15. data/client/skr/components/InvoiceLink.cjsx +13 -0
  16. data/client/skr/components/LocationChooser.cjsx +37 -0
  17. data/client/skr/components/PaymentCategoryFinder.cjsx +34 -0
  18. data/client/skr/components/PrintFormChooser.cjsx +29 -0
  19. data/client/skr/components/SalesOrderFinder.cjsx +38 -0
  20. data/client/skr/components/ScreenControls.cjsx +20 -0
  21. data/client/skr/components/SkuFinder.cjsx +30 -0
  22. data/client/skr/components/SkuLines.cjsx +76 -0
  23. data/client/skr/components/SystemSettings.cjsx +26 -0
  24. data/client/skr/components/TermsChooser.cjsx +40 -0
  25. data/client/skr/components/ToolbarButton.cjsx +7 -0
  26. data/client/skr/components/TotalsLine.cjsx +21 -0
  27. data/client/skr/components/TriStateIcon.cjsx +12 -0
  28. data/client/skr/components/UOMChooser.cjsx +24 -0
  29. data/client/skr/components/UserPreferences.cjsx +30 -0
  30. data/client/skr/components/VendorFinder.cjsx +40 -0
  31. data/client/skr/components/address/Address.cjsx +10 -10
  32. data/client/skr/components/styles.scss +16 -0
  33. data/client/skr/index.js +3 -1
  34. data/client/skr/models/Address.coffee +9 -1
  35. data/client/skr/models/BankAccount.coffee +17 -0
  36. data/client/skr/models/Base.coffee +6 -0
  37. data/client/skr/models/Customer.coffee +17 -10
  38. data/client/skr/models/CustomerProject.coffee +29 -0
  39. data/client/skr/models/GlAccount.coffee +22 -10
  40. data/client/skr/models/GlManualEntry.coffee +4 -2
  41. data/client/skr/models/GlPeriod.coffee +4 -6
  42. data/client/skr/models/GlPosting.coffee +7 -7
  43. data/client/skr/models/GlTransaction.coffee +3 -3
  44. data/client/skr/models/IaLine.coffee +9 -9
  45. data/client/skr/models/IaReason.coffee +4 -4
  46. data/client/skr/models/InvLine.coffee +30 -11
  47. data/client/skr/models/InventoryAdjustment.coffee +8 -6
  48. data/client/skr/models/Invoice.coffee +89 -18
  49. data/client/skr/models/Location.coffee +27 -6
  50. data/client/skr/models/Payment.coffee +36 -0
  51. data/client/skr/models/PaymentCategory.coffee +12 -0
  52. data/client/skr/models/PaymentTerm.coffee +17 -4
  53. data/client/skr/models/PickTicket.coffee +7 -5
  54. data/client/skr/models/PoLine.coffee +15 -15
  55. data/client/skr/models/PoReceipt.coffee +8 -6
  56. data/client/skr/models/PorLine.coffee +11 -11
  57. data/client/skr/models/PricingProvider.coffee +6 -0
  58. data/client/skr/models/PtLine.coffee +13 -13
  59. data/client/skr/models/PurchaseOrder.coffee +11 -9
  60. data/client/skr/models/SalesOrder.coffee +59 -22
  61. data/client/skr/models/Sku.coffee +17 -15
  62. data/client/skr/models/SkuLoc.coffee +14 -9
  63. data/client/skr/models/SkuTran.coffee +10 -10
  64. data/client/skr/models/SkuVendor.coffee +9 -9
  65. data/client/skr/models/SoLine.coffee +27 -20
  66. data/client/skr/models/TimeEntry.coffee +75 -0
  67. data/client/skr/models/Uom.coffee +27 -6
  68. data/client/skr/models/Vendor.coffee +14 -12
  69. data/client/skr/models/VoLine.coffee +11 -11
  70. data/client/skr/models/Voucher.coffee +7 -5
  71. data/client/skr/models/mixins/HasVisibleId.coffee +7 -0
  72. data/client/skr/models/mixins/PrintSupport.coffee +6 -0
  73. data/client/skr/models/mixins/SkuLine.coffee +61 -0
  74. data/client/skr/screens/Commands.coffee +29 -0
  75. data/client/skr/screens/bank-maint/BankMaint.cjsx +43 -0
  76. data/client/skr/screens/bank-maint/index.js +5 -0
  77. data/client/skr/screens/chart-of-accounts/ChartOfAccounts.cjsx +40 -0
  78. data/client/skr/screens/chart-of-accounts/index.js +1 -0
  79. data/client/skr/screens/chart-of-accounts/index.scss +12 -0
  80. data/client/skr/screens/customer-maint/CustomerMaint.cjsx +35 -36
  81. data/client/skr/screens/customer-projects/CustomerProjects.cjsx +70 -0
  82. data/client/skr/screens/customer-projects/index.js +5 -0
  83. data/client/skr/screens/customer-projects/index.scss +25 -0
  84. data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +35 -0
  85. data/client/skr/screens/fresh-books-import/ChooseRecords.cjsx +116 -0
  86. data/client/skr/screens/fresh-books-import/FreshBooksImport.cjsx +31 -0
  87. data/client/skr/screens/fresh-books-import/Import.coffee +52 -0
  88. data/client/skr/screens/fresh-books-import/ViewRecords.cjsx +96 -0
  89. data/client/skr/screens/fresh-books-import/index.js +1 -0
  90. data/client/skr/screens/fresh-books-import/index.scss +39 -0
  91. data/client/skr/screens/gl-accounts/GlAccounts.cjsx +31 -0
  92. data/client/skr/screens/gl-accounts/index.js +5 -0
  93. data/client/skr/screens/gl-transactions/GlTransactions.cjsx +46 -0
  94. data/client/skr/screens/gl-transactions/index.js +1 -0
  95. data/client/skr/screens/gl-transactions/index.scss +12 -0
  96. data/client/skr/screens/invoice/Invoice.cjsx +92 -0
  97. data/client/skr/screens/invoice/Payment.cjsx +28 -0
  98. data/client/skr/screens/invoice/index.js +5 -0
  99. data/client/skr/screens/locations/Locations.cjsx +31 -0
  100. data/client/skr/screens/locations/index.js +5 -0
  101. data/client/skr/screens/payment-category/PaymentCategory.cjsx +28 -0
  102. data/client/skr/screens/payment-category/index.js +5 -0
  103. data/client/skr/screens/payment-category/index.scss +9 -0
  104. data/client/skr/screens/payment-terms/PaymentTerms.cjsx +28 -0
  105. data/client/skr/screens/payment-terms/index.js +5 -0
  106. data/client/skr/screens/payment-terms/index.scss +9 -0
  107. data/client/skr/screens/payments/Payments.cjsx +59 -0
  108. data/client/skr/screens/payments/index.js +5 -0
  109. data/client/skr/screens/sales-order/SalesOrder.cjsx +68 -0
  110. data/client/skr/screens/sales-order/index.js +1 -5
  111. data/client/skr/screens/sku-maint/SkuMaint.cjsx +53 -0
  112. data/client/skr/screens/sku-maint/SkuUomList.cjsx +209 -0
  113. data/client/skr/screens/sku-maint/index.js +2 -5
  114. data/client/skr/screens/sku-maint/index.scss +37 -6
  115. data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +156 -0
  116. data/client/skr/screens/time-invoicing/index.js +5 -0
  117. data/client/skr/screens/time-invoicing/index.scss +7 -0
  118. data/client/skr/screens/time-tracking/EditEntry.cjsx +54 -0
  119. data/client/skr/screens/time-tracking/Entries.coffee +132 -0
  120. data/client/skr/screens/time-tracking/Header.cjsx +71 -0
  121. data/client/skr/screens/time-tracking/Popover.cjsx +70 -0
  122. data/client/skr/screens/time-tracking/PopoverMiniControls.cjsx +25 -0
  123. data/client/skr/screens/time-tracking/TimeTracking.cjsx +63 -0
  124. data/client/skr/screens/time-tracking/WeekSummary.cjsx +16 -0
  125. data/client/skr/screens/time-tracking/index.js +1 -0
  126. data/client/skr/screens/time-tracking/index.scss +126 -0
  127. data/client/skr/screens/vendor-maint/VendorMaint.cjsx +45 -0
  128. data/client/skr/screens/vendor-maint/index.js +1 -5
  129. data/client/skr/styles.scss +1 -13
  130. data/config/puma.rb +4 -0
  131. data/config/routes.rb +21 -9
  132. data/config/screens.rb +147 -32
  133. data/db/migrate/20140202194700_create_skr_gl_transaction_details.rb +35 -0
  134. data/db/migrate/20140220031800_create_skr_locations.rb +2 -0
  135. data/db/migrate/20140220190836_create_skr_vendors.rb +1 -0
  136. data/db/migrate/20140220203029_create_skr_customers.rb +3 -2
  137. data/db/migrate/20140224034759_create_skr_skus.rb +2 -3
  138. data/db/migrate/20140322223912_create_skr_sales_orders.rb +4 -3
  139. data/db/migrate/20140322223920_create_skr_so_lines.rb +4 -5
  140. data/db/migrate/20140323001446_create_so_details_view.rb +7 -5
  141. data/db/migrate/20140327202209_create_skr_pt_lines.rb +2 -2
  142. data/db/migrate/20140327214000_create_customer_project.rb +16 -0
  143. data/db/migrate/20140327223002_create_time_entries.rb +17 -0
  144. data/db/migrate/20140327224000_create_skr_invoices.rb +5 -1
  145. data/db/migrate/20140327224002_create_skr_inv_lines.rb +3 -1
  146. data/db/migrate/20140422024010_create_skr_inv_details_view.rb +1 -1
  147. data/db/migrate/20151121211323_create_customer_project_details_views.rb +31 -0
  148. data/db/migrate/20160216142845_create_gl_account_balances_view.rb +20 -0
  149. data/db/migrate/20160229002044_create_bank_accounts.rb +18 -0
  150. data/db/migrate/20160229041711_create_payments.rb +33 -0
  151. data/db/migrate/20160307022705_create_create_combined_uom_views.rb +18 -0
  152. data/db/schema.sql +639 -140
  153. data/db/seed/chart_of_accounts.yml +8 -6
  154. data/db/seed/payment_categories.yml +12 -0
  155. data/db/seed/skus.yml +32 -0
  156. data/db/seed.rb +21 -0
  157. data/lib/skr/access_roles.rb +19 -6
  158. data/lib/skr/concerns/has_sku_loc_lines.rb +0 -16
  159. data/lib/skr/concerns/inv_extensions.rb +24 -0
  160. data/lib/skr/concerns/is_sku_loc_line.rb +3 -4
  161. data/lib/skr/concerns/so_extensions.rb +8 -0
  162. data/lib/skr/concerns/visible_id_identifier.rb +1 -1
  163. data/lib/skr/db/migration_helpers.rb +2 -4
  164. data/lib/skr/extension.rb +11 -4
  165. data/lib/skr/handlers/fresh_books_import.rb +20 -0
  166. data/lib/skr/handlers/invoice_from_time_entries.rb +49 -0
  167. data/lib/skr/jobs/fresh_books/base.rb +54 -0
  168. data/lib/skr/jobs/fresh_books/import.rb +151 -0
  169. data/lib/skr/jobs/fresh_books/retrieve.rb +62 -0
  170. data/lib/skr/model.rb +5 -0
  171. data/lib/skr/models/address.rb +1 -1
  172. data/lib/skr/models/bank_account.rb +13 -0
  173. data/lib/skr/models/business_entity.rb +3 -0
  174. data/lib/skr/models/customer.rb +1 -1
  175. data/lib/skr/models/customer_project.rb +22 -0
  176. data/lib/skr/models/gl_account.rb +13 -3
  177. data/lib/skr/models/gl_period.rb +6 -0
  178. data/lib/skr/models/gl_posting.rb +7 -4
  179. data/lib/skr/models/gl_transaction.rb +19 -33
  180. data/lib/skr/models/ia_line.rb +1 -1
  181. data/lib/skr/models/inv_line.rb +33 -15
  182. data/lib/skr/models/invoice.rb +47 -20
  183. data/lib/skr/models/location.rb +7 -1
  184. data/lib/skr/models/payment.rb +49 -0
  185. data/lib/skr/models/payment_category.rb +11 -0
  186. data/lib/skr/models/payment_term.rb +1 -1
  187. data/lib/skr/models/por_line.rb +1 -1
  188. data/lib/skr/models/pt_line.rb +1 -1
  189. data/lib/skr/models/sales_order.rb +9 -9
  190. data/lib/skr/models/sku_loc.rb +1 -1
  191. data/lib/skr/models/sku_tran.rb +6 -11
  192. data/lib/skr/models/so_line.rb +22 -12
  193. data/lib/skr/models/time_entry.rb +36 -0
  194. data/lib/skr/models/uom.rb +11 -10
  195. data/lib/skr/models/user_proxy.rb +1 -1
  196. data/lib/skr/number.rb +25 -0
  197. data/lib/skr/print/form.rb +46 -0
  198. data/lib/skr/print/template.rb +48 -0
  199. data/lib/skr/print.rb +11 -0
  200. data/lib/skr/string.rb +11 -0
  201. data/lib/skr/version.rb +1 -1
  202. data/lib/skr.rb +9 -0
  203. data/spec/fixtures/skr/address.yml +164 -4
  204. data/spec/fixtures/skr/bank_account.yml +8 -0
  205. data/spec/fixtures/skr/customer.yml +30 -4
  206. data/spec/fixtures/skr/customer_project.yml +20 -0
  207. data/spec/fixtures/skr/gl_account.yml +19 -1
  208. data/spec/fixtures/skr/gl_period.yml +3 -0
  209. data/spec/fixtures/skr/gl_posting.yml +22 -1
  210. data/spec/fixtures/skr/gl_transaction.yml +4 -1
  211. data/spec/fixtures/skr/inv_line.yml +35 -0
  212. data/spec/fixtures/skr/invoice.yml +13 -2
  213. data/spec/fixtures/skr/location.yml +5 -0
  214. data/spec/fixtures/skr/payment.yml +10 -0
  215. data/spec/fixtures/skr/payment_category.yml +8 -0
  216. data/spec/fixtures/skr/payment_term.yml +37 -3
  217. data/spec/fixtures/skr/sales_order.yml +12 -1
  218. data/spec/fixtures/skr/sku.yml +78 -1
  219. data/spec/fixtures/skr/sku_loc.yml +42 -1
  220. data/spec/fixtures/skr/sku_tran.yml +24 -1
  221. data/spec/fixtures/skr/so_line.yml +32 -0
  222. data/spec/fixtures/skr/time_entry.yml +82 -0
  223. data/spec/fixtures/skr/uom.yml +52 -1
  224. data/spec/fixtures/skr/vendor.yml +28 -1
  225. data/spec/fixtures/stockor.png +0 -0
  226. data/spec/server/bank_account_spec.rb +10 -0
  227. data/spec/server/customer_project_spec.rb +10 -0
  228. data/spec/server/handlers/invoice_from_time_entries_spec.rb +49 -0
  229. data/spec/server/jobs/fresh_books/import_spec.rb +69 -0
  230. data/spec/server/jobs/fresh_books/retrieve_spec.rb +37 -0
  231. data/spec/server/models/address_spec.rb +4 -3
  232. data/spec/server/models/gl_transaction_spec.rb +3 -3
  233. data/spec/server/models/inv_line_spec.rb +83 -3
  234. data/spec/server/models/invoice_spec.rb +32 -3
  235. data/spec/server/models/payment_spec.rb +40 -0
  236. data/spec/server/models/sales_order_spec.rb +1 -1
  237. data/spec/server/models/so_line_spec.rb +3 -3
  238. data/spec/server/models/spec_helper_spec.rb +1 -1
  239. data/spec/server/payment_spec.rb +10 -0
  240. data/spec/server/print/form_spec.rb +47 -0
  241. data/spec/server/print/template_spec.rb +36 -0
  242. data/spec/server/spec_helper.rb +14 -1
  243. data/spec/server/time_entry_spec.rb +10 -0
  244. data/spec/skr/components/SkuLinesSpec.coffee +61 -0
  245. data/spec/skr/models/BankAccountSpec.coffee +5 -0
  246. data/spec/skr/models/CustomerProjectSpec.coffee +5 -0
  247. data/spec/skr/models/CustomerSpec.coffee +2 -2
  248. data/spec/skr/models/PaymentSpec.coffee +5 -0
  249. data/spec/skr/models/SalesOrderSpec.coffee +21 -5
  250. data/spec/skr/models/SoLineSpec.coffee +7 -2
  251. data/spec/skr/models/TimeEntrySpec.coffee +5 -0
  252. data/spec/skr/screens/bank-maint/BankMaintSpec.coffee +5 -0
  253. data/spec/skr/screens/customer-projects/CustomerProjectsSpec.coffee +5 -0
  254. data/spec/skr/screens/fresh-books-import/FreshBooksImportSpec.coffee +1 -0
  255. data/spec/skr/screens/gl-accounts/GlAccountsSpec.coffee +5 -0
  256. data/spec/skr/screens/invoice/InvoiceSpec.coffee +5 -0
  257. data/spec/skr/screens/locations/LocationsSpec.coffee +5 -0
  258. data/spec/skr/screens/payment-category/PaymentCategorySpec.coffee +5 -0
  259. data/spec/skr/screens/payment-terms/PaymentTermsSpec.coffee +5 -0
  260. data/spec/skr/screens/payments/PaymentsSpec.coffee +5 -0
  261. data/spec/skr/screens/time-invoicing/TimeInvoicingSpec.coffee +5 -0
  262. data/spec/skr/screens/time-tracking/TimeTrackingSpec.coffee +14 -0
  263. data/spec/vcr/freshbooks.yml +698 -0
  264. data/stockor.gemspec +5 -1
  265. data/templates/print/fonts/GnuMICR.otf +0 -0
  266. data/templates/print/layout.tex.erb +39 -0
  267. data/templates/print/packages/booktabs.sty +182 -0
  268. data/templates/print/packages/fancybox.sty +966 -0
  269. data/templates/print/packages/fancyhdr.sty +485 -0
  270. data/templates/print/packages/graphbox.sty +129 -0
  271. data/templates/print/packages/lastpage.sty +283 -0
  272. data/templates/print/packages/lastpage209.sty +70 -0
  273. data/templates/print/packages/marginnote.sty +412 -0
  274. data/templates/print/packages/multirow.sty +159 -0
  275. data/templates/print/packages/rotating.sty +282 -0
  276. data/templates/print/packages/tabu.sty +2557 -0
  277. data/templates/print/packages/textpos.sty +361 -0
  278. data/templates/print/packages/varwidth.sty +318 -0
  279. data/templates/print/partials/address.tex.erb +6 -0
  280. data/templates/print/partials/bill_to_ship_to.tex.erb +13 -0
  281. data/templates/print/partials/header.tex.erb +13 -0
  282. data/templates/print/partials/invoice_paid_state.tex.erb +2 -0
  283. data/templates/print/partials/old/inv_lines_grouping.tex.erb +8 -0
  284. data/templates/print/partials/old/labor_lines_footer.tex.erb +18 -0
  285. data/templates/print/partials/skus_table.tex.erb +32 -0
  286. data/templates/print/partials/skus_table_col_hdr.tex.erb +8 -0
  287. data/templates/print/partials/skus_table_footer.tex.erb +5 -0
  288. data/templates/print/partials/skus_table_group_footer.tex.erb +4 -0
  289. data/templates/print/partials/skus_table_invoice_footer.tex.erb +25 -0
  290. data/templates/print/partials/skus_table_invoice_info_line.tex.erb +16 -0
  291. data/templates/print/partials/skus_table_labor_col_hdr.tex.erb +8 -0
  292. data/templates/print/partials/skus_table_labor_group_footer.tex.erb +7 -0
  293. data/templates/print/partials/skus_table_labor_line.tex.erb +11 -0
  294. data/templates/print/partials/skus_table_line.tex.erb +6 -0
  295. data/templates/print/partials/skus_table_other_charge_lines.tex.erb +7 -0
  296. data/templates/print/partials/so_info_line.tex.erb +14 -0
  297. data/templates/print/types/invoice/default.tex.erb +13 -0
  298. data/templates/print/types/invoice/labor.tex.erb +33 -0
  299. data/templates/print/types/payment/default.tex.erb +64 -0
  300. data/templates/print/types/sales-order/default.tex.erb +8 -0
  301. metadata +252 -15
  302. data/client/skr/components/address/address.html +0 -20
  303. data/client/skr/models/mixins/CodeField.coffee +0 -5
  304. data/client/skr/screens/customer-maint/index.scss +0 -11
  305. data/client/skr/screens/customer-maint/layout.html +0 -32
  306. data/client/skr/screens/sales-order/SalesOrder.coffee +0 -30
  307. data/client/skr/screens/sales-order/index.scss +0 -8
  308. data/client/skr/screens/sales-order/layout.html +0 -30
  309. data/client/skr/screens/sku-maint/SkuMaint.coffee +0 -18
  310. data/client/skr/screens/sku-maint/layout.html +0 -16
  311. data/client/skr/screens/vendor-maint/VendorMaint.coffee +0 -28
  312. data/client/skr/screens/vendor-maint/index.scss +0 -8
  313. data/client/skr/screens/vendor-maint/layout.html +0 -32
data/config/screens.rb CHANGED
@@ -1,49 +1,164 @@
1
+ Lanes::Screen.define_group 'accounting' do | group |
2
+ group.title = "Accounting"
3
+ group.description = "Accounting functions"
4
+ group.icon = "line-chart"
5
+ end
6
+
1
7
  Lanes::Screen.define_group 'maint' do | group |
2
8
  group.title = "Maintenance"
3
9
  group.description = "Maintain records"
4
10
  group.icon = "pencil-square"
5
11
  end
12
+
6
13
  Lanes::Screen.define_group 'customer' do | group |
7
14
  group.title = "Customer"
8
15
  group.description = "Customer records"
9
16
  group.icon = "heart"
10
17
  end
11
- Lanes::Screen.for_extension 'Skr' do | screens |
18
+
19
+ Lanes::Screen.for_extension 'skr' do | screens |
20
+ # System Settings
21
+ screens.define "locations" do | screen |
22
+ screen.title = "Locations"
23
+ screen.description = ""
24
+ screen.icon = "globe"
25
+ screen.group_id = "system-settings"
26
+ screen.model_class = "Location"
27
+ screen.view_class = "Locations"
28
+ end
29
+ screens.define "fresh-books-import" do | screen |
30
+ screen.title = "Fresh Books Import"
31
+ screen.description = ""
32
+ screen.icon = "cloud-download"
33
+ screen.group_id = "system-settings"
34
+ screen.model_class = "Invoice"
35
+ screen.view_class = "FreshBooksImport"
36
+ end
37
+
38
+ ## ACCOUNTING GROUP
39
+ screens.define "time-invoicing" do | screen |
40
+ screen.title = "Time Invoicing"
41
+ screen.description = ""
42
+ screen.icon = "hourglass"
43
+ screen.group_id = "accounting"
44
+ screen.model_class = "Invoice"
45
+ screen.model_access = "write"
46
+ screen.view_class = "TimeInvoicing"
47
+ end
48
+ screens.define "payments" do | screen |
49
+ screen.title = "Payments"
50
+ screen.description = ""
51
+ screen.icon = "file-text-o"
52
+ screen.group_id = "accounting"
53
+ screen.model_class = "Payment"
54
+ screen.view_class = "Payments"
55
+ end
56
+ screens.define "bank-maint" do | screen |
57
+ screen.title = "Bank Maint"
58
+ screen.description = ""
59
+ screen.icon = "bank"
60
+ screen.group_id = "accounting"
61
+ screen.model_class = "BankAccount"
62
+ screen.view_class = "BankMaint"
63
+ end
64
+ screens.define "payment-terms" do | screen |
65
+ screen.title = "Payment Terms"
66
+ screen.description = ""
67
+ screen.icon = "money"
68
+ screen.group_id = "accounting"
69
+ screen.model_access = "write"
70
+ screen.model_class = "PaymentTerm"
71
+ screen.view_class = "PaymentTerms"
72
+ end
73
+ screens.define "payment-category" do | screen |
74
+ screen.title = "Payment Categories"
75
+ screen.description = ""
76
+ screen.icon = "object-group"
77
+ screen.group_id = "accounting"
78
+ screen.model_class = "PaymentCategory"
79
+ screen.view_class = "PaymentCategory"
80
+ end
81
+ screens.define "chart-of-accounts" do | screen |
82
+ screen.title = "Chart Of Accounts"
83
+ screen.description = ""
84
+ screen.icon = "list-alt"
85
+ screen.group_id = "accounting"
86
+ screen.model_class = "GlTransaction"
87
+ screen.view_class = "ChartOfAccounts"
88
+ 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
+ screens.define "customer-projects" do | screen |
98
+ screen.title = "Customer Projects"
99
+ screen.description = ""
100
+ screen.icon = "briefcase"
101
+ screen.group_id = "accounting"
102
+ screen.model_access = "write"
103
+ screen.model_class = "Invoice"
104
+ screen.view_class = "CustomerProjects"
105
+ end
106
+ screens.define "gl-accounts" do | screen |
107
+ screen.title = "Gl Accounts"
108
+ screen.description = ""
109
+ screen.icon = "archive"
110
+ screen.model_access = "write"
111
+ screen.group_id = "accounting"
112
+ screen.model_class = "GlAccount"
113
+ screen.view_class = "GlAccounts"
114
+ end
115
+
116
+ # MAINT GROUP
117
+ screens.define "sku-maint" do | screen |
118
+ screen.title = "SKU Maintenance"
119
+ screen.icon = "archive"
120
+ screen.group_id = "maint"
121
+ screen.model_class = "Sku"
122
+ screen.view_class = "SkuMaint"
123
+ end
12
124
  screens.define "customer-maint" do | screen |
13
125
  screen.title = "Customer Maintenance"
14
126
  screen.icon = "heartbeat"
15
127
  screen.group_id = "maint"
16
128
  screen.model_class = "Customer"
17
129
  screen.view_class = "CustomerMaint"
18
- screen.js = 'customer-maint.js'
19
- screen.css = 'customer-maint.css'
20
- end
21
- # screens.define "sku-maint" do | screen |
22
- # screen.title = "SKU Maintenance"
23
- # screen.icon = "archive"
24
- # screen.group_id = "maint"
25
- # screen.model_class = "Sku"
26
- # screen.view_class = "SkuMaint"
27
- # screen.js = "sku-maint.js"
28
- # screen.css = "sku-maint.css"
29
- # end
30
- # screens.define "vendor-maint" do | screen |
31
- # screen.title = "Vendor Maintenance"
32
- # screen.icon = "truck"
33
- # screen.group_id = "maint"
34
- # screen.model_class = "Vendor"
35
- # screen.view_class = "Skr.Screens.VendorMaint"
36
- # screen.js = "vendor-maint.js"
37
- # screen.css = "vendor-maint.css"
38
- # end
39
- # screens.define "sales-order" do | screen |
40
- # screen.title = "Sales Order"
41
- # screen.description = ""
42
- # screen.icon = "shopping-cart"
43
- # screen.group_id = "customer"
44
- # screen.model_class = "SalesOrder"
45
- # screen.view_class = "Skr.Screens.SalesOrder"
46
- # screen.js = "sales-order.js"
47
- # screen.css = "sales-order.css"
48
- # end
130
+ end
131
+ screens.define "vendor-maint" do | screen |
132
+ screen.title = "Vendor Maintenance"
133
+ screen.icon = "truck"
134
+ screen.group_id = "maint"
135
+ screen.model_class = "Vendor"
136
+ screen.view_class = "VendorMaint"
137
+ end
138
+
139
+ # CUSTOMER
140
+ screens.define "sales-order" do | screen |
141
+ screen.title = "Sales Order"
142
+ screen.description = ""
143
+ screen.icon = "shopping-cart"
144
+ screen.group_id = "customer"
145
+ screen.model_class = "SalesOrder"
146
+ screen.view_class = "SalesOrder"
147
+ end
148
+ screens.define "invoice" do | screen |
149
+ screen.title = "Invoice"
150
+ screen.description = "Invoices"
151
+ screen.icon = "money"
152
+ screen.group_id = "customer"
153
+ screen.model_class = "Invoice"
154
+ screen.view_class = "Invoice"
155
+ end
156
+ screens.define "time-tracking" do | screen |
157
+ screen.title = "Time Tracking"
158
+ screen.description = ""
159
+ screen.icon = "hourglass-start"
160
+ screen.group_id = "customer"
161
+ screen.model_class = "TimeEntry"
162
+ screen.view_class = "TimeTracking"
163
+ end
49
164
  end
@@ -0,0 +1,35 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreateSkrGlTransactionDetails < ActiveRecord::Migration
4
+
5
+ def up
6
+ execute <<-EOS
7
+ create view #{skr_prefix}gl_transaction_details as
8
+ select
9
+ glt.id as gl_transaction_id,
10
+ to_char(glt.created_at,'YYYY-MM-DD') as transaction_date,
11
+ pr.period as accounting_period,
12
+ pr.year as accounting_year,
13
+ ( select array_agg(account_number) from
14
+ skr_gl_postings where gl_transaction_id=glt.id ) as account_numbers,
15
+ ( select array_to_json(array_agg(row_to_json(postings))) from (
16
+ select account_number, amount
17
+ from skr_gl_postings
18
+ where gl_transaction_id=glt.id and is_debit='t')
19
+ postings) as debit_details,
20
+ ( select array_to_json(array_agg(row_to_json(postings))) from (
21
+ select account_number, amount
22
+ from skr_gl_postings
23
+ where gl_transaction_id=glt.id and is_debit='f')
24
+ postings) as credit_details
25
+ from #{skr_prefix}gl_transactions glt
26
+ join #{skr_prefix}gl_periods pr on pr.id = glt.period_id
27
+
28
+ EOS
29
+ end
30
+
31
+ def down
32
+ execute "drop view #{skr_prefix}gl_transaction_details"
33
+ end
34
+
35
+ end
@@ -12,6 +12,8 @@ class CreateSkrLocations < ActiveRecord::Migration
12
12
  default: Skr.config.default_branch_code,
13
13
  null: false,
14
14
  limit: 2
15
+ t.string "logo"
16
+ t.jsonb "options"
15
17
  t.skr_track_modifications
16
18
  end
17
19
 
@@ -9,6 +9,7 @@ class CreateSkrVendors < ActiveRecord::Migration
9
9
  t.skr_reference :terms, null: false, to_table: :payment_terms
10
10
  t.skr_reference :gl_payables_account, null: false, to_table: :gl_accounts
11
11
  t.skr_reference :gl_freight_account, null: false, to_table: :gl_accounts
12
+ t.skr_currency :open_balance, default: 0.0
12
13
  t.string "code", null: false
13
14
  t.string "hash_code", null: false
14
15
  t.string "name", null: false
@@ -2,7 +2,6 @@ require 'skr/db/migration_helpers'
2
2
 
3
3
  class CreateSkrCustomers < ActiveRecord::Migration
4
4
  def change
5
-
6
5
  create_skr_table "customers" do |t|
7
6
  t.skr_code_identifier
8
7
  t.skr_reference :billing_address, null: false, to_table: :addresses
@@ -11,11 +10,13 @@ class CreateSkrCustomers < ActiveRecord::Migration
11
10
  t.skr_reference :gl_receivables_account, null: false, to_table: :gl_accounts
12
11
  t.skr_currency :credit_limit, default: 0.0
13
12
  t.skr_currency :open_balance, default: 0.0
13
+ t.boolean "is_tax_exempt", null: false, default: false
14
14
  t.string "hash_code", null: false
15
15
  t.string "name", null: false
16
16
  t.text "notes"
17
17
  t.text "website"
18
- t.hstore "options", default: {}
18
+ t.jsonb "options"
19
+ t.jsonb "forms"
19
20
  t.skr_track_modifications
20
21
  end
21
22
  end
@@ -10,9 +10,8 @@ class CreateSkrSkus < ActiveRecord::Migration
10
10
  t.string "default_uom_code", null: false
11
11
  t.string "code", null: false
12
12
  t.string "description", null: false
13
- t.boolean "is_other_charge", null: false, default: false
14
- t.boolean "does_track_inventory", null: false, default: false
15
- t.boolean "can_backorder", null: false, default: false
13
+ t.boolean :is_discontinued, :is_other_charge, :does_track_inventory, :can_backorder,
14
+ null: false, default: false
16
15
  t.skr_track_modifications
17
16
  end
18
17
 
@@ -1,8 +1,8 @@
1
1
  require 'skr/db/migration_helpers'
2
2
 
3
3
  class CreateSkrSalesOrders < ActiveRecord::Migration
4
- def change
5
4
 
5
+ def change
6
6
  create_skr_table "sales_orders" do |t|
7
7
  t.skr_visible_id
8
8
  t.skr_state
@@ -11,16 +11,17 @@ class CreateSkrSalesOrders < ActiveRecord::Migration
11
11
  t.skr_reference :shipping_address, to_table: 'addresses'
12
12
  t.skr_reference :billing_address, to_table: 'addresses'
13
13
  t.skr_reference :terms, to_table: 'payment_terms'
14
+ t.boolean "is_tax_exempt", null: false, default: false
14
15
  t.date "order_date", null: false
15
16
  t.boolean "is_revised", null: false, default: false
16
17
  t.string "hash_code", null: false
17
18
  t.boolean "ship_partial", null: false, default: false
18
19
  t.string "po_num"
19
20
  t.text "notes"
20
- t.hstore "options", default: {}
21
+ t.string "form"
22
+ t.jsonb "options", default: {}
21
23
  t.skr_track_modifications
22
24
  end
23
-
24
25
  end
25
26
 
26
27
  end
@@ -12,12 +12,11 @@ class CreateSkrSoLines < ActiveRecord::Migration
12
12
  t.string "uom_code", null: false
13
13
  t.integer "uom_size", null: false, limit: 2
14
14
  t.integer "position", null: false, limit: 2
15
- t.integer "qty", null: false, default: 0
16
- t.integer "qty_allocated", null: false, default: 0
17
- t.integer "qty_picking", null: false, default: 0
18
- t.integer "qty_invoiced", null: false, default: 0
19
- t.integer "qty_canceled", null: false, default: 0
15
+ t.decimal "qty", null: false, precision: 15, scale: 2
16
+ t.decimal "qty_allocated", "qty_picking", "qty_picking",
17
+ "qty_invoiced", "qty_canceled", null: false, default: 0, precision: 15, scale: 2
20
18
  t.boolean "is_revised", null: false, default: false
19
+ t.jsonb "options"
21
20
  t.skr_track_modifications
22
21
  end
23
22
 
@@ -2,13 +2,14 @@ require 'skr/db/migration_helpers'
2
2
 
3
3
  class CreateSoDetailsView < ActiveRecord::Migration
4
4
  def up
5
+ fk = "#{skr_prefix}sales_order_id"
5
6
  execute <<-EOS.squish
6
- create view #{skr_prefix}so_amount_details as
7
- select so.id as sales_order_id,
7
+ create view #{skr_prefix}so_details as
8
+ select so.id as #{fk},
8
9
  to_char(so.order_date,'YYYY-MM-DD') as string_order_date,
9
10
  cust.code as customer_code, cust.name as customer_name,
10
11
  addr.name as bill_addr_name,
11
- coalesce( ttls.total,0.0 ) as total,
12
+ coalesce( ttls.total,0.0 ) as order_total,
12
13
  coalesce( ttls.num_lines, 0 ) as num_lines,
13
14
  coalesce( ttls.other_charge_total, 0 ) as total_other_charge_amount,
14
15
  coalesce( ttls.tax_charge_total, 0 ) as total_tax_amount,
@@ -36,7 +37,8 @@ class CreateSoDetailsView < ActiveRecord::Migration
36
37
 
37
38
  execute <<-EOS.squish
38
39
  create view #{skr_prefix}so_allocation_details as
39
- select sales_order_id, count(*) as number_of_lines, sum(sol.qty_allocated*price) as allocated_total,
40
+ select sales_order_id as #{fk},
41
+ count(*) as number_of_lines, sum(sol.qty_allocated*price) as allocated_total,
40
42
  sum( case when sol.qty_allocated - sol.qty_canceled - sol.qty_picking > 0 then 1 else 0 end )
41
43
  as number_of_lines_allocated,
42
44
  sum( case when sol.qty_allocated = (sol.qty - sol.qty_canceled - sol.qty_picking)
@@ -57,7 +59,7 @@ class CreateSoDetailsView < ActiveRecord::Migration
57
59
  date_trunc('day', (current_date - days_ago)) as day,
58
60
  coalesce( ttls.order_count, 0 ) as order_count,
59
61
  coalesce( ttls.line_count, 0 ) as line_count,
60
- coalesce(ttls.total,0.0) as total
62
+ coalesce(ttls.total,0.0) as line_total
61
63
  from generate_series(0, 120, 1) as days_ago
62
64
  left join (
63
65
  select
@@ -14,8 +14,8 @@ class CreateSkrPtLines < ActiveRecord::Migration
14
14
  t.string "bin", null: true
15
15
  t.integer "uom_size", null: false, limit: 2
16
16
  t.integer "position", null: false, limit: 2
17
- t.integer "qty", null: false, default: 0
18
- t.integer "qty_invoiced", null: false, default: 0
17
+ t.decimal "qty", null: false, precision: 15, scale: 2
18
+ t.integer "qty_invoiced", null: false, default: 0, precision: 15, scale: 2
19
19
  t.boolean "is_complete", null: false, default: false
20
20
  end
21
21
 
@@ -0,0 +1,16 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreateCustomerProject < ActiveRecord::Migration
4
+ def change
5
+ create_skr_table :customer_projects do |t|
6
+ t.skr_code_identifier
7
+ t.text :name, :description, :po_num
8
+ t.skr_reference :sku, single: true
9
+ t.skr_reference :customer, single: true
10
+ t.string :invoice_form
11
+ t.jsonb :rates
12
+ t.jsonb :options
13
+ t.timestamps null: false
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreateTimeEntries < ActiveRecord::Migration
4
+ def change
5
+ create_skr_table :time_entries do |t|
6
+ t.skr_reference :customer_project, single: true
7
+ t.references :lanes_user, null: false, index: true, foreign_key: true
8
+ t.boolean :is_invoiced, null: false, default: false
9
+ t.jsonb :options, null: false, default: {}
10
+ t.datetime :start_at, null: false
11
+ t.datetime :end_at, null: false
12
+ t.text :description, null: false
13
+ t.skr_track_modifications
14
+ end
15
+
16
+ end
17
+ end
@@ -9,15 +9,19 @@ class CreateSkrInvoices < ActiveRecord::Migration
9
9
  t.skr_reference :terms, to_table: 'payment_terms'
10
10
  t.skr_reference :customer, single: true
11
11
  t.skr_reference :location, single: true
12
+ t.skr_reference :customer_project, single: true, null: true
12
13
  t.skr_reference :sales_order, single: true, null: true
13
14
  t.skr_reference :pick_ticket, single: true, null: true
14
15
  t.skr_reference :shipping_address, to_table: 'addresses'
15
16
  t.skr_reference :billing_address, to_table: 'addresses'
16
17
  t.skr_currency :amount_paid, null: false, default: 0.0
18
+ t.boolean "is_tax_exempt", null: false, default: false
17
19
  t.string "hash_code", null: false
18
20
  t.date "invoice_date", null: false
19
21
  t.string "po_num"
20
- t.hstore "options", default: {}
22
+ t.text "notes"
23
+ t.string "form"
24
+ t.jsonb "options"
21
25
  t.skr_track_modifications
22
26
  end
23
27
  end
@@ -8,14 +8,16 @@ class CreateSkrInvLines < ActiveRecord::Migration
8
8
  t.skr_reference :sku_loc, null: false, single: true
9
9
  t.skr_reference :pt_line, null: true, single: true
10
10
  t.skr_reference :so_line, null: true, single: true
11
+ t.skr_reference :time_entry, null: true, single: true
11
12
  t.skr_currency :price, null: false
12
13
  t.string "sku_code", null: false
13
14
  t.string "description", null: false
14
15
  t.string "uom_code", null: false
15
16
  t.integer "uom_size", null: false, limit: 2
16
17
  t.integer "position", null: false, limit: 2
17
- t.integer "qty", null: false
18
+ t.decimal "qty", null: false, precision: 15, scale: 2
18
19
  t.boolean "is_revised", null: false, default: false
20
+ t.jsonb "options"
19
21
  t.skr_track_modifications
20
22
  end
21
23
  end
@@ -13,7 +13,7 @@ class CreateSkrInvDetailsView < ActiveRecord::Migration
13
13
  to_char(inv.created_at,'YYYY-MM-DD') as string_invoice_date,
14
14
  cust.code as customer_code, cust.name as customer_name,
15
15
  ba.name as bill_addr_name,
16
- coalesce( ttls.total,0.0 ) as total,
16
+ coalesce( ttls.total,0.0 ) as invoice_total,
17
17
  coalesce( ttls.num_lines, 0 ) as num_lines,
18
18
  coalesce( ttls.other_charge_total, 0 ) as total_other_charge_amount,
19
19
  coalesce( ttls.total,0.0 ) - coalesce( ttls.other_charge_total, 0.0 ) as subtotal_amount
@@ -0,0 +1,31 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreateCustomerProjectDetailsViews < ActiveRecord::Migration
4
+
5
+ def up
6
+ execute <<-EOS
7
+ create view #{view} as
8
+ select
9
+ cp.id as skr_customer_project_id,
10
+ c.code as customer_code,
11
+ c.name as customer_description,
12
+ s.code as sku_code,
13
+ s.description as sku_description
14
+
15
+ from #{skr_prefix}customer_projects cp
16
+ join #{skr_prefix}skus s on s.id=cp.sku_id
17
+ join #{skr_prefix}customers c on c.id=cp.customer_id
18
+ EOS
19
+ end
20
+
21
+ def down
22
+ execute "drop view #{view}"
23
+ end
24
+
25
+ private
26
+
27
+ def view
28
+ "#{skr_prefix}customer_project_details"
29
+ end
30
+
31
+ end
@@ -0,0 +1,20 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreateGlAccountBalancesView < ActiveRecord::Migration
4
+ def up
5
+ execute <<-EOS.squish
6
+ create view #{skr_prefix}gl_account_balances as select
7
+ gla.id as skr_gl_account_id,
8
+ right(glp.account_number,2) as branch_number,
9
+ coalesce(sum(glp.amount), 0.00) as balance
10
+ from skr_gl_accounts gla
11
+ left join skr_gl_postings glp
12
+ on left(glp.account_number, 4) = gla.number
13
+ group by gla.id, branch_number order by number
14
+ EOS
15
+ end
16
+
17
+ def down
18
+ execute "drop view #{skr_prefix}gl_trial_balance"
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreateBankAccounts < ActiveRecord::Migration
4
+ def change
5
+
6
+ create_skr_table :bank_accounts do |t|
7
+ t.text :code, null: false
8
+ t.text :name, null: false
9
+ t.text :description
10
+ t.text :routing_number
11
+ t.text :account_number
12
+ t.skr_reference :address, null: false, to_table: :addresses
13
+ t.skr_reference :gl_account, null: false, to_table: :gl_accounts
14
+ t.timestamps null: false
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreatePayments < ActiveRecord::Migration
4
+ def change
5
+
6
+ create_skr_table :payment_categories do |t|
7
+ t.string :code, null: false
8
+ t.string :name, null: false
9
+ t.skr_reference :gl_account, null: false, to_table: :gl_accounts
10
+ t.timestamps null: false
11
+ end
12
+
13
+ create_skr_table :payments do |t|
14
+ t.skr_visible_id
15
+
16
+ t.skr_reference :bank_account, null: false, single: true
17
+ t.skr_reference :category, null: false, single: true,
18
+ to_table: 'payment_categories'
19
+ t.skr_reference :vendor, null: true, single: true
20
+ t.skr_reference :location, null: false, single: true
21
+
22
+ t.string :hash_code, null: false
23
+ t.skr_currency :amount, null: false
24
+ t.date :date, null: false
25
+ t.integer :check_number, null: false
26
+ t.text :name, null: false
27
+ t.text :address, :notes
28
+
29
+ t.timestamps null: false
30
+ end
31
+
32
+ end
33
+ end
@@ -0,0 +1,18 @@
1
+ require 'skr/db/migration_helpers'
2
+
3
+ class CreateCreateCombinedUomViews < ActiveRecord::Migration
4
+ def up
5
+ execute <<-EOS
6
+ create view #{skr_prefix}combined_uom as
7
+ select
8
+ uom.id as skr_uom_id,
9
+ case when size = 1 then code else code||'/'||size end as combined_uom
10
+ from #{skr_prefix}uoms uom
11
+ EOS
12
+ end
13
+
14
+ def down
15
+ execute "drop view #{skr_prefix}combined_uom"
16
+ end
17
+
18
+ end