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/client/skr/index.js
CHANGED
@@ -2,7 +2,7 @@ class Skr.Models.Address extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
5
|
+
id: {type:"integer"}
|
6
6
|
name: "string"
|
7
7
|
email: "string"
|
8
8
|
phone: "string"
|
@@ -14,3 +14,11 @@ class Skr.Models.Address extends Skr.Models.Base
|
|
14
14
|
|
15
15
|
modelForAccess: ->
|
16
16
|
@parent || this
|
17
|
+
|
18
|
+
clonedAttributes: ->
|
19
|
+
_.omit @serialize(), 'id'
|
20
|
+
|
21
|
+
|
22
|
+
toString: ->
|
23
|
+
line3 = _.compact([ @city, @state, @postal_code ]).join(' ')
|
24
|
+
_.compact([@line1, @line2, line3]).join("\n") || ''
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Skr.Models.BankAccount extends Skr.Models.Base
|
2
|
+
|
3
|
+
props:
|
4
|
+
id: {type:"integer"}
|
5
|
+
code: {type:"code"}
|
6
|
+
name: {type:"string", "required":true}
|
7
|
+
description: {type:"string"}
|
8
|
+
routing_number: "string"
|
9
|
+
account_number: "string"
|
10
|
+
address_id: {type:"integer"}
|
11
|
+
gl_account_id: {type:"integer"}
|
12
|
+
|
13
|
+
mixins: ['HasCodeField']
|
14
|
+
|
15
|
+
associations:
|
16
|
+
address: { model: "Address" }
|
17
|
+
gl_account: { model: "GlAccount", required: true }
|
@@ -2,24 +2,31 @@ class Skr.Models.Customer extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
code: {
|
7
|
-
billing_address_id: {
|
8
|
-
shipping_address_id: {
|
9
|
-
terms_id: {
|
10
|
-
gl_receivables_account_id:{
|
5
|
+
id: {type:"integer"}
|
6
|
+
code: {type:"code"}
|
7
|
+
billing_address_id: {type:"integer"}
|
8
|
+
shipping_address_id: {type:"integer"}
|
9
|
+
terms_id: {type:"integer"}
|
10
|
+
gl_receivables_account_id:{type:"integer", default: ->
|
11
|
+
Skr.Models.GlAccount.default_ids.ar
|
12
|
+
}
|
11
13
|
credit_limit: "bigdec"
|
12
14
|
open_balance: "bigdec"
|
13
|
-
hash_code: {
|
14
|
-
name: {
|
15
|
+
hash_code: {type:"string"}
|
16
|
+
name: {type:"string", required: true}
|
15
17
|
notes: "string"
|
16
18
|
website: "string"
|
19
|
+
forms: "any"
|
17
20
|
options: "any"
|
18
21
|
|
22
|
+
mixins: ['HasCodeField']
|
23
|
+
|
19
24
|
associations:
|
20
25
|
billing_address: { model: "Address" }
|
21
26
|
shipping_address: { model: "Address" }
|
22
|
-
terms: { model: "PaymentTerm" }
|
23
|
-
gl_receivables_account: { model: "GlAccount"
|
27
|
+
terms: { model: "PaymentTerm", required: true}
|
28
|
+
gl_receivables_account: { model: "GlAccount", default: ->
|
29
|
+
Skr.Models.GlAccount.all.get(this.gl_receivables_account_id)
|
30
|
+
}
|
24
31
|
sales_orders: { collection: "SalesOrder" }
|
25
32
|
invoices: { collection: "Invoice" }
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Skr.Models.CustomerProject extends Skr.Models.Base
|
2
|
+
|
3
|
+
@COLORS: _.map([
|
4
|
+
'gray', 'blue', 'orange', 'green', 'pink',
|
5
|
+
'brown', 'purple', 'yellow' , 'red', 'tan'
|
6
|
+
], (v, i) -> {id: i + 1, name: v})
|
7
|
+
|
8
|
+
props:
|
9
|
+
id: {"type":"integer" }
|
10
|
+
code: {"type":"code" }
|
11
|
+
name: {"type":"string" }
|
12
|
+
description: {"type":"string" }
|
13
|
+
po_num: {"type":"string" }
|
14
|
+
invoice_form: {"type":"string" }
|
15
|
+
sku_id: {"type":"integer" }
|
16
|
+
customer_id: {"type":"integer" }
|
17
|
+
options: "any"
|
18
|
+
rates: "any"
|
19
|
+
|
20
|
+
mixins: ['HasCodeField']
|
21
|
+
|
22
|
+
session:
|
23
|
+
sku_code: {type:"string"}
|
24
|
+
customer_code: {type:"string"}
|
25
|
+
|
26
|
+
associations:
|
27
|
+
customer: { model: "Customer", required: true }
|
28
|
+
sku: { model: "Sku", required: true }
|
29
|
+
time_entries: { collection: 'TimeEntry', inverse: 'customer_project' }
|
@@ -1,20 +1,32 @@
|
|
1
|
-
|
1
|
+
SHARED_DATA = null
|
2
|
+
SHARED_COLLECTION = null
|
2
3
|
|
3
|
-
|
4
|
+
class Skr.Models.GlAccount extends Skr.Models.Base
|
4
5
|
|
5
6
|
props:
|
6
|
-
id:
|
7
|
-
number:
|
8
|
-
name:
|
9
|
-
|
7
|
+
id: {type:"integer"}
|
8
|
+
number: {type:"string", required:true}
|
9
|
+
name: {type:"string", required:true}
|
10
|
+
description: {type: 'string', default: '' }
|
11
|
+
is_active: {type:"boolean", default: true}
|
12
|
+
|
13
|
+
# optional attributes from trial balance view
|
14
|
+
session:
|
15
|
+
balance: {type:"bigdec"}
|
16
|
+
branch_number: {type:"string"}
|
10
17
|
|
11
18
|
derived:
|
12
19
|
combined_name:
|
13
20
|
deps: ['number', 'name'], fn: ->
|
14
|
-
if @
|
15
|
-
|
21
|
+
if @number and @name then "#{@number}: #{@name}" else ''
|
16
22
|
|
17
23
|
@initialize: (data) ->
|
18
24
|
this.default_ids = data.default_ids
|
19
|
-
|
20
|
-
|
25
|
+
SHARED_DATA = data.accounts
|
26
|
+
|
27
|
+
|
28
|
+
Object.defineProperty Skr.Models.GlAccount, 'all',
|
29
|
+
get: ->
|
30
|
+
SHARED_COLLECTION ||= new Skr.Models.GlAccount.Collection(
|
31
|
+
SHARED_DATA, comparator: 'number'
|
32
|
+
)
|
@@ -2,9 +2,11 @@ class Skr.Models.GlManualEntry extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
visible_id:{
|
5
|
+
id: {type:"integer"}
|
6
|
+
visible_id:{type:"visible_id"}
|
7
7
|
notes: "string"
|
8
8
|
|
9
|
+
mixins: [ 'HasVisibleId' ]
|
10
|
+
|
9
11
|
associations:
|
10
12
|
gl_transaction: { model: "GlTransaction" }
|
@@ -1,9 +1,7 @@
|
|
1
1
|
class Skr.Models.GlPeriod extends Skr.Models.Base
|
2
2
|
|
3
|
-
|
4
3
|
props:
|
5
|
-
id: {
|
6
|
-
year: {
|
7
|
-
period: {
|
8
|
-
is_locked:{
|
9
|
-
|
4
|
+
id: {type:"integer"}
|
5
|
+
year: {type:"integer", required: true}
|
6
|
+
period: {type:"integer", required: true}
|
7
|
+
is_locked:{type:"boolean", default:false}
|
@@ -2,13 +2,13 @@ class Skr.Models.GlPosting extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
gl_transaction_id:{
|
7
|
-
account_number: {
|
8
|
-
amount: {
|
9
|
-
is_debit: {
|
10
|
-
year: {
|
11
|
-
period: {
|
5
|
+
id: {type:"integer"}
|
6
|
+
gl_transaction_id:{type:"integer"}
|
7
|
+
account_number: {type:"string"}
|
8
|
+
amount: {type:"bigdec"}
|
9
|
+
is_debit: {type:"boolean"}
|
10
|
+
year: {type:"integer"}
|
11
|
+
period: {type:"integer"}
|
12
12
|
|
13
13
|
associations:
|
14
14
|
gl_transaction: { model: "GlTransaction" }
|
@@ -2,11 +2,11 @@ class Skr.Models.GlTransaction extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
period_id: {
|
5
|
+
id: {type:"integer"}
|
6
|
+
period_id: {type:"integer"}
|
7
7
|
source_id: "integer"
|
8
8
|
source_type:"string"
|
9
|
-
description:{
|
9
|
+
description:{type:"string"}
|
10
10
|
|
11
11
|
associations:
|
12
12
|
source: { model: "Source" }
|
@@ -2,17 +2,17 @@ class Skr.Models.IaLine extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
inventory_adjustment_id:{
|
7
|
-
sku_loc_id: {
|
8
|
-
qty: {
|
9
|
-
uom_code: {
|
10
|
-
uom_size: {
|
5
|
+
id: {type:"integer"}
|
6
|
+
inventory_adjustment_id:{type:"integer"}
|
7
|
+
sku_loc_id: {type:"integer"}
|
8
|
+
qty: {type:"integer", "default":"1"}
|
9
|
+
uom_code: {type:"string", "default":"EA"}
|
10
|
+
uom_size: {type:"integer", "default":"1"}
|
11
11
|
cost: "bigdec"
|
12
|
-
cost_was_set: {
|
12
|
+
cost_was_set: {type:"boolean", default:false}
|
13
13
|
|
14
14
|
associations:
|
15
15
|
inventory_adjustment: { model: "InventoryAdjustment" }
|
16
|
-
sku_loc: { model: "SkuLoc" }
|
17
|
-
sku: { model: "Sku"
|
16
|
+
sku_loc: { model: "SkuLoc", required: true}
|
17
|
+
sku: { model: "Sku"}
|
18
18
|
sku_tran: { model: "SkuTran" }
|
@@ -2,10 +2,10 @@ class Skr.Models.IaReason extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
gl_account_id:{
|
7
|
-
code: {
|
8
|
-
description: {
|
5
|
+
id: {type:"integer"}
|
6
|
+
gl_account_id:{type:"integer"}
|
7
|
+
code: {type:"string"}
|
8
|
+
description: {type:"string"}
|
9
9
|
|
10
10
|
associations:
|
11
11
|
gl_account: { model: "GlAccount" }
|
@@ -1,20 +1,21 @@
|
|
1
1
|
class Skr.Models.InvLine extends Skr.Models.Base
|
2
2
|
|
3
|
+
mixins: [ Skr.Models.Mixins.SkuLine ]
|
3
4
|
|
4
5
|
props:
|
5
|
-
id: {
|
6
|
-
invoice_id: {
|
7
|
-
sku_loc_id: {
|
6
|
+
id: {type:"integer"}
|
7
|
+
invoice_id: {type:"integer"}
|
8
|
+
sku_loc_id: {type:"integer"}
|
8
9
|
pt_line_id: "integer"
|
9
10
|
so_line_id: "integer"
|
10
|
-
price: {
|
11
|
-
sku_code: {
|
12
|
-
description:{
|
13
|
-
uom_code: {
|
14
|
-
uom_size: {
|
15
|
-
position: {
|
16
|
-
qty: {
|
17
|
-
is_revised: {
|
11
|
+
price: {type:"bigdec"}
|
12
|
+
sku_code: {type:"string"}
|
13
|
+
description:{type:"string"}
|
14
|
+
uom_code: {type:"string", default: 'EA'}
|
15
|
+
uom_size: {type:"integer", default: 1}
|
16
|
+
position: {type:"integer"}
|
17
|
+
qty: {type:"bigdec", default:"0"}
|
18
|
+
is_revised: {type:"boolean", default:false}
|
18
19
|
|
19
20
|
associations:
|
20
21
|
invoice: { model: "Invoice" }
|
@@ -24,3 +25,21 @@ class Skr.Models.InvLine extends Skr.Models.Base
|
|
24
25
|
sku: { model: "Sku" }
|
25
26
|
location: { model: "Location" }
|
26
27
|
sku_tran: { model: "SkuTran" }
|
28
|
+
|
29
|
+
derived:
|
30
|
+
location_id:
|
31
|
+
deps: ['invoice'], fn: ->
|
32
|
+
@invoice.location_id
|
33
|
+
|
34
|
+
modelForAccess: ->
|
35
|
+
@invoice || this
|
36
|
+
|
37
|
+
dataForSave: ->
|
38
|
+
# lines should never send associations
|
39
|
+
super(excludeAssociations: true)
|
40
|
+
|
41
|
+
|
42
|
+
@fromSoLine: (l) ->
|
43
|
+
invl = new Skr.Models.InvLine( l.serialize() )
|
44
|
+
invl.unset('id')
|
45
|
+
invl
|
@@ -2,12 +2,14 @@ class Skr.Models.InventoryAdjustment extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
visible_id: {
|
7
|
-
location_id:{
|
8
|
-
reason_id: {
|
9
|
-
state: {
|
10
|
-
description:{
|
5
|
+
id: {type:"integer"}
|
6
|
+
visible_id: {type:"visible_id"}
|
7
|
+
location_id:{type:"integer"}
|
8
|
+
reason_id: {type:"integer"}
|
9
|
+
state: {type:"string"}
|
10
|
+
description:{type:"string"}
|
11
|
+
|
12
|
+
mixins: [ 'HasVisibleId' ]
|
11
13
|
|
12
14
|
associations:
|
13
15
|
gl_transaction: { model: "GlTransaction" }
|
@@ -2,29 +2,100 @@ class Skr.Models.Invoice extends Skr.Models.Base
|
|
2
2
|
|
3
3
|
|
4
4
|
props:
|
5
|
-
id: {
|
6
|
-
visible_id: {
|
7
|
-
terms_id: {
|
8
|
-
customer_id: {
|
9
|
-
location_id: {
|
5
|
+
id: {type:"integer"}
|
6
|
+
visible_id: {type:"visible_id"}
|
7
|
+
terms_id: {type:"integer"}
|
8
|
+
customer_id: {type:"integer"}
|
9
|
+
location_id: {type:"integer", default: ->
|
10
|
+
Skr.Models.Location.default.id
|
11
|
+
}
|
10
12
|
sales_order_id: "integer"
|
11
13
|
pick_ticket_id: "integer"
|
12
|
-
shipping_address_id:{
|
13
|
-
billing_address_id: {
|
14
|
-
amount_paid: {
|
15
|
-
state: {
|
16
|
-
hash_code: {
|
17
|
-
invoice_date: {
|
14
|
+
shipping_address_id:{type:"integer"}
|
15
|
+
billing_address_id: {type:"integer"}
|
16
|
+
amount_paid: {type:"bigdec", "default":"0"}
|
17
|
+
state: {type:"string"}
|
18
|
+
hash_code: {type:"string"}
|
19
|
+
invoice_date: {type:"date", default: ->
|
20
|
+
new Date
|
21
|
+
}
|
22
|
+
notes: "string"
|
18
23
|
po_num: "string"
|
24
|
+
form: "string"
|
19
25
|
options: "any"
|
20
26
|
|
27
|
+
mixins: [ 'HasVisibleId', 'PrintSupport' ]
|
28
|
+
|
29
|
+
# optional attributes from details view
|
30
|
+
session:
|
31
|
+
customer_code: {type:"string"}
|
32
|
+
invoice_total: {type:"bigdec"}
|
33
|
+
|
34
|
+
derived:
|
35
|
+
prev_amount_paid: deps:['updated_at'], fn: -> @amount_paid
|
36
|
+
open_amount: deps: ['total', 'amount_paid'], fn: ->
|
37
|
+
@total.minus(@amount_paid)
|
38
|
+
total: deps: ['invoice_total'], fn: ->
|
39
|
+
@invoice_total or @lines.reduce( (t, l) ->
|
40
|
+
t.plus(l.total)
|
41
|
+
, _.bigDecimal(0))
|
42
|
+
|
43
|
+
enums:
|
44
|
+
state:
|
45
|
+
open: 1
|
46
|
+
paid: 5
|
47
|
+
partial: 9
|
48
|
+
|
21
49
|
associations:
|
22
|
-
sales_order: { model: "SalesOrder" }
|
23
|
-
customer: { model: "Customer" }
|
24
|
-
location: { model: "Location" }
|
25
|
-
terms: { model: "PaymentTerm" }
|
26
|
-
pick_ticket: { model: "PickTicket" }
|
27
50
|
billing_address: { model: "Address" }
|
28
51
|
shipping_address: { model: "Address" }
|
29
|
-
|
30
|
-
|
52
|
+
sales_order: { model: "SalesOrder", readOnly:true }
|
53
|
+
customer: { model: "Customer", required: true, readOnly:true }
|
54
|
+
location: { model: "Location", required: true, readOnly:true, default: ->
|
55
|
+
Skr.Models.Location.all.get(@location_id) if @location_id
|
56
|
+
}
|
57
|
+
terms: { model: "PaymentTerm", required: true, readOnly:true }
|
58
|
+
pick_ticket: { model: "PickTicket", readOnly:true }
|
59
|
+
lines: { collection: "InvLine", inverse: 'invoice' }
|
60
|
+
gl_transactions: { collection: "GlTransaction", readOnly:true }
|
61
|
+
|
62
|
+
events:
|
63
|
+
'change:customer': 'onSetCustomer'
|
64
|
+
'lines add remove change:total': 'onChangeTotal'
|
65
|
+
|
66
|
+
onChangeTotal: ->
|
67
|
+
@trigger('change', @, {})
|
68
|
+
@unCacheDerived('total')
|
69
|
+
@unset('invoice_total')
|
70
|
+
|
71
|
+
onSetCustomer: (newCustomer) ->
|
72
|
+
return if not newCustomer or newCustomer.isNew()
|
73
|
+
@copyAssociationsFrom( newCustomer, 'billing_address', 'shipping_address')
|
74
|
+
|
75
|
+
setFromSalesOrder: (so) ->
|
76
|
+
@sales_order_id = so.id
|
77
|
+
for attr in ['customer_code', 'po_num', 'notes', 'terms_id', 'form']
|
78
|
+
@set(attr, so[attr])
|
79
|
+
|
80
|
+
@associations.replace(@, 'sales_order', @sales_order)
|
81
|
+
@copyAssociationsFrom(so,
|
82
|
+
'customer', 'billing_address', 'shipping_address'
|
83
|
+
).then =>
|
84
|
+
so.lines.fetch(with: ['sku_code'], include: ['sku']).then =>
|
85
|
+
@lines.reset so.lines.map(Skr.Models.InvLine.fromSoLine)
|
86
|
+
@onChangeTotal()
|
87
|
+
@trigger('change', @, {})
|
88
|
+
|
89
|
+
copyAssociationsFrom: ( model, associations... ) ->
|
90
|
+
new _.Promise (res, rej) =>
|
91
|
+
model.withAssociations(associations).then =>
|
92
|
+
for name in associations
|
93
|
+
@associations.replace(@, name, model[name])
|
94
|
+
res(@)
|
95
|
+
|
96
|
+
dataForSave: ->
|
97
|
+
# only send some associations
|
98
|
+
super(onlyAssociations: ['lines', 'billing_address', 'shipping_address'])
|
99
|
+
|
100
|
+
isPaidInFull: ->
|
101
|
+
@state == 'paid'
|
@@ -1,14 +1,35 @@
|
|
1
|
+
SHARED_DATA = null
|
2
|
+
SHARED_COLLECTION = null
|
3
|
+
|
1
4
|
class Skr.Models.Location extends Skr.Models.Base
|
2
5
|
|
6
|
+
cacheDuration: [1, 'day']
|
7
|
+
|
8
|
+
mixins: [ 'FileSupport', 'HasCodeField' ]
|
3
9
|
|
4
10
|
props:
|
5
|
-
id: {
|
6
|
-
code: {
|
7
|
-
name: {
|
8
|
-
address_id: {
|
9
|
-
is_active: {
|
10
|
-
gl_branch_code:{
|
11
|
+
id: {type:"integer"}
|
12
|
+
code: {type:"code"}
|
13
|
+
name: {type:"string"}
|
14
|
+
address_id: {type:"integer"}
|
15
|
+
is_active: {type:"boolean", "default":true}
|
16
|
+
gl_branch_code:{type:"string", "default":"01"}
|
17
|
+
logo: "file"
|
18
|
+
options: "any"
|
11
19
|
|
12
20
|
associations:
|
13
21
|
address: { model: "Address" }
|
14
22
|
sku_locs: { collection: "SkuLoc" }
|
23
|
+
|
24
|
+
@initialize: (data) ->
|
25
|
+
SHARED_DATA = data.locations
|
26
|
+
|
27
|
+
|
28
|
+
Object.defineProperties Skr.Models.Location, {
|
29
|
+
all:
|
30
|
+
get: ->
|
31
|
+
SHARED_COLLECTION ||= new Skr.Models.Location.Collection( SHARED_DATA )
|
32
|
+
default:
|
33
|
+
get: ->
|
34
|
+
@all.findWhere(code: 'DEFAULT') || @all.first()
|
35
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Skr.Models.Payment extends Skr.Models.Base
|
2
|
+
|
3
|
+
props:
|
4
|
+
id: {type:"integer"}
|
5
|
+
visible_id: {type:"string"}
|
6
|
+
hash_code: {type:"string"}
|
7
|
+
bank_account_id:{type:"integer"}
|
8
|
+
category_id: {type:"integer"}
|
9
|
+
vendor_id: "integer"
|
10
|
+
location_id: "integer"
|
11
|
+
amount: {type:"bigdec", required:true}
|
12
|
+
check_number: {type:"integer"}
|
13
|
+
date: {type:"date", default: ->
|
14
|
+
new Date
|
15
|
+
}
|
16
|
+
name: {type: "string", required: true}
|
17
|
+
address: "string"
|
18
|
+
notes: "string"
|
19
|
+
|
20
|
+
mixins: [ 'PrintSupport', 'HasVisibleId' ]
|
21
|
+
|
22
|
+
associations:
|
23
|
+
category: { model: "PaymentCategory" }
|
24
|
+
vendor: { model: "Vendor" }
|
25
|
+
bank_account: { model: "BankAccount" }
|
26
|
+
location: { model: "Location" }
|
27
|
+
gl_transaction: { model: "GlTransaction" }
|
28
|
+
|
29
|
+
events:
|
30
|
+
'change:vendor': 'onSetVendor'
|
31
|
+
|
32
|
+
onSetVendor: (newVendor) ->
|
33
|
+
return unless newVendor and Lanes.u.isModel(newVendor)
|
34
|
+
@name = newVendor.name
|
35
|
+
newVendor.withAssociations(['billing_address']).then =>
|
36
|
+
@address = newVendor.billing_address.toString()
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Skr.Models.PaymentCategory extends Skr.Models.Base
|
2
|
+
|
3
|
+
props:
|
4
|
+
id: {"type":"integer"}
|
5
|
+
code: {type:"code"}
|
6
|
+
name: {"type":"string"}
|
7
|
+
gl_account_id:{"type":"integer"}
|
8
|
+
|
9
|
+
mixins: [ 'HasCodeField' ]
|
10
|
+
|
11
|
+
associations:
|
12
|
+
gl_account: { model: "GlAccount", required: true }
|
@@ -1,10 +1,23 @@
|
|
1
|
+
SHARED_DATA = null
|
2
|
+
SHARED_COLLECTION = null
|
3
|
+
|
1
4
|
class Skr.Models.PaymentTerm extends Skr.Models.Base
|
2
5
|
|
3
6
|
|
4
7
|
props:
|
5
|
-
id: {
|
6
|
-
code: {
|
7
|
-
days: {
|
8
|
-
description: {
|
8
|
+
id: {type:"integer"}
|
9
|
+
code: {type:"code"}
|
10
|
+
days: {type:"integer", "default":"0"}
|
11
|
+
description: {type:"string"}
|
9
12
|
discount_days: "integer"
|
10
13
|
discount_amount:"string"
|
14
|
+
|
15
|
+
@initialize: (data) ->
|
16
|
+
SHARED_DATA = data.payment_terms
|
17
|
+
|
18
|
+
|
19
|
+
Object.defineProperty Skr.Models.PaymentTerm, 'all',
|
20
|
+
get: ->
|
21
|
+
SHARED_COLLECTION ||= new Skr.Models.PaymentTerm.Collection(
|
22
|
+
SHARED_DATA, comparator: 'code'
|
23
|
+
)
|