bookyt_pos 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile ADDED
@@ -0,0 +1,45 @@
1
+ # Settings
2
+ # ========
3
+ source :rubygems
4
+
5
+ gemspec
6
+
7
+ # Rails
8
+ # =====
9
+ gem 'rails', '~> 3.0.9'
10
+
11
+ # Development
12
+ # ===========
13
+ group :development do
14
+ end
15
+
16
+ # Test
17
+ # ====
18
+ group :test do
19
+ # Framework
20
+ gem "rspec"
21
+ gem "rspec-rails"
22
+
23
+ # Browser
24
+ gem "capybara"
25
+
26
+ # Fixtures
27
+ gem "factory_girl_rails", "~>1.1.rc1"
28
+ gem "factory_girl", "~>2.0.0.rc1"
29
+
30
+ # Matchers/Helpers
31
+ gem 'shoulda'
32
+ gem 'accept_values_for'
33
+
34
+ # Autotest
35
+ gem 'autotest'
36
+ gem 'autotest-rails'
37
+
38
+ # Database
39
+ gem "sqlite3"
40
+ end
41
+
42
+ # Gem
43
+ # ===
44
+ # Date/Time handling
45
+ gem 'validates_timeliness'
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2011 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = BookytPos
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ require 'rake'
10
+ require 'rdoc/task'
11
+
12
+ require 'rspec/core'
13
+ require 'rspec/core/rake_task'
14
+
15
+ RSpec::Core::RakeTask.new(:spec)
16
+
17
+ task :default => :spec
18
+
19
+ Rake::RDocTask.new(:rdoc) do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'BookytPos'
22
+ rdoc.options << '--line-numbers' << '--inline-source'
23
+ rdoc.rdoc_files.include('README.rdoc')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
@@ -0,0 +1,15 @@
1
+ class DaysController < AuthorizedController
2
+ def create
3
+ # Create and redirect to index
4
+ create! {days_path}
5
+ end
6
+
7
+ # AJAX methods
8
+ def calculate_cash
9
+ bills = params[:cash_register].select { |a| a[0].to_f > 5 }
10
+ mint = params[:cash_register].select { |a| a[0].to_f <= 5 }
11
+
12
+ @cash = bills.map { |a| a[0].to_f * a[1].to_f }.sum
13
+ @cash += mint.map { |a| a[1].to_f }.sum
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ class DaysController < AuthorizedController
2
+ def create
3
+ create! {days_path}
4
+ end
5
+
6
+ # AJAX methods
7
+ def calculate_cash
8
+ bills = params[:cash_register].select { |a| a[0].to_f > 5 }
9
+ mint = params[:cash_register].select { |a| a[0].to_f <= 5 }
10
+
11
+ @cash = bills.map { |a| a[0].to_f * a[1].to_f }.sum
12
+ @cash += mint.map { |a| a[1].to_f }.sum
13
+ end
14
+ end
data/app/models/day.rb ADDED
@@ -0,0 +1,23 @@
1
+ class Day < ActiveRecord::Base
2
+ # Associations
3
+ validates_date :date
4
+
5
+ # Scopes
6
+ default_scope :order => 'date DESC'
7
+
8
+ # Helpers
9
+ def to_s
10
+ "%s: brutto %0.2f, netto %0.2f" % [date, gross_turnover, net_turnover]
11
+ end
12
+
13
+ # Callbacks
14
+ after_create :create_bookings
15
+
16
+ private
17
+ def create_bookings
18
+ BookingTemplate.create_booking('day:cash', :amount => cash, :value_date => date)
19
+ BookingTemplate.create_booking('day:card turnover', :amount => card_turnover, :value_date => date)
20
+ BookingTemplate.create_booking('day:expenses', :amount => expenses, :value_date => date)
21
+ BookingTemplate.create_booking('day:credit_turnover', :amount => credit_turnover, :value_date => date)
22
+ end
23
+ end
@@ -0,0 +1,47 @@
1
+ // bookyt POS
2
+ // ==========
3
+
4
+ // Cash up styling
5
+ #cash_register_new,
6
+ #new_day
7
+ +column($column_small_form)
8
+
9
+ #cash_register_new
10
+ ul
11
+ width: 50%
12
+ float: left
13
+ &.second
14
+ li
15
+ width: 141px
16
+ float: right
17
+ label
18
+ width: 45px
19
+ float: left
20
+ input
21
+ width: 90px
22
+ #cash
23
+ float: left
24
+ color: red
25
+ text-decoration: underline
26
+ font-weight: bold
27
+ #result
28
+ width: 100%
29
+ margin-top: 10px
30
+ padding-top: 10px
31
+ border-top: 1px solid black
32
+ label
33
+ font-weight: bold
34
+ margin-right: 15px
35
+ input
36
+ width: 100%
37
+ li:first-child
38
+ margin-bottom: 10px
39
+
40
+ #new_day
41
+ label
42
+ width: 160px
43
+ input
44
+ width: 100px
45
+ float: right
46
+ &#day_submit
47
+ width: 100%
@@ -0,0 +1,118 @@
1
+ @import partials/content/table_list
2
+ @import partials/content/icons
3
+ @import partials/formtastic/formtastic_base
4
+ @import partials/content/ajax_indicator
5
+ @import partials/content/flash_errors
6
+ @import partials/content/fancy_buttons
7
+ @import partials/content/overview
8
+ @import partials/content/pagination
9
+ @import partials/content/cyt
10
+
11
+ @import partials/content/application
12
+
13
+ // Headers styling
14
+ h1,
15
+ h2,
16
+ h3
17
+ +sanserif-font
18
+ font-weight: bold
19
+ border-bottom: 1px solid #bbbbbb
20
+
21
+ h2
22
+ font-size: $h2_size
23
+ margin-bottom: $h2_size
24
+
25
+ h1
26
+ font-size: $h1_size
27
+ margin-bottom: $h1_size
28
+
29
+ h3
30
+ font-size: $h3_size
31
+ margin-bottom: 0.4em
32
+ margin-top: 1.2em
33
+
34
+ a
35
+ text-decoration: none
36
+ color: $link_color
37
+ &:hover
38
+ color: $link_color_hover
39
+
40
+ // Cash up styling
41
+ #cash_register_new,
42
+ #new_day
43
+ +column($column_small_form)
44
+
45
+ #cash_register_new
46
+ ul
47
+ width: 50%
48
+ float: left
49
+ &.second
50
+ li
51
+ width: 141px
52
+ float: right
53
+ label
54
+ width: 45px
55
+ float: left
56
+ input
57
+ width: 90px
58
+ #cash
59
+ float: left
60
+ color: red
61
+ text-decoration: underline
62
+ font-weight: bold
63
+ #result
64
+ width: 100%
65
+ margin-top: 10px
66
+ padding-top: 10px
67
+ border-top: 1px solid black
68
+ label
69
+ font-weight: bold
70
+ margin-right: 15px
71
+ input
72
+ width: 100%
73
+ li:first-child
74
+ margin-bottom: 10px
75
+
76
+ #new_day
77
+ label
78
+ width: 160px
79
+ input
80
+ width: 100px
81
+ float: right
82
+ &#day_submit
83
+ width: 100%
84
+
85
+ // Form styling
86
+ form.formtastic
87
+ +float-form
88
+
89
+ #day_edit
90
+ table
91
+ th
92
+ padding-right: 20px
93
+
94
+ // Accounting **
95
+ tr.currency, th.currency
96
+ text-align: right
97
+
98
+ .booking_list tr
99
+ td
100
+ background-color: white
101
+ border-left: 0px none
102
+ border-right: 0px none
103
+ border-bottom: 1px solid
104
+ border-left: 0px none
105
+ border-right: 0px none
106
+
107
+ // Snippet from Redmine.css
108
+ .contextual
109
+ float: right
110
+ white-space: nowrap
111
+ line-height: 1.4em
112
+ margin-top: 5px
113
+ padding-left: 10px
114
+ font-size: 0.9em
115
+ input
116
+ font-size: 0.9em
117
+
118
+ // End of snippet
@@ -0,0 +1,21 @@
1
+ = form_for @register, :remote => true, :as =>:cash_register, :url => {:action => 'calculate_cash'}, :html => {:class => 'formtastic cash_register_new'} do |f|
2
+ %ul.first
3
+ - for i in [ 200, 100, 50, 20, 10 ]
4
+ %li
5
+ %label
6
+ = h i
7
+ x
8
+ = f.text_field i, :type => 'number'
9
+ %ul.second
10
+ - for i in [ 5, 2, 1, 0.5, 0.2, 0.1, 0.05 ]
11
+ %li
12
+ %label
13
+ = h i
14
+ = f.text_field i, :type => 'number'
15
+ %ul#result
16
+ %li
17
+ %label
18
+ = t('activerecord.attributes.day.total') + ':'
19
+ #cash
20
+ %li
21
+ = submit_tag t('activerecord.attributes.day.calculate')
@@ -0,0 +1,3 @@
1
+ = render 'calculate'
2
+
3
+ = render 'form'
@@ -0,0 +1,13 @@
1
+ %tr[day]
2
+ %td= day.date
3
+ %td.currency= currency_fmt(day.cash)
4
+ %td.currency= currency_fmt(day.card_turnover)
5
+ %td.currency= currency_fmt(day.gross_turnover)
6
+ %td.currency= currency_fmt(day.net_turnover)
7
+ %td.currency= currency_fmt(day.client_count)
8
+ %td.currency= currency_fmt(day.expenses)
9
+ %td.currency= currency_fmt(day.credit_turnover)
10
+ %td.currency= currency_fmt(day.discount)
11
+ %td.action-links
12
+ = list_link_for(:edit, day)
13
+ = list_link_for(:delete, day)
@@ -0,0 +1,15 @@
1
+ = semantic_form_for @day do |f|
2
+ = f.semantic_errors
3
+ = f.inputs do
4
+ = f.input :date, :as => :date_field, :input_html => {"data-autofocus" => true, :size => 10, :style => 'text-align: right'}
5
+ = f.input :cash, :input_html => {:size => 12, :style => 'text-align: right'}
6
+ = f.input :card_turnover, :input_html => {:size => 12, :style => 'text-align: right'}
7
+ = f.input :gross_turnover, :input_html => {:size => 12, :style => 'text-align: right'}
8
+ = f.input :net_turnover, :input_html => {:size => 12, :style => 'text-align: right'}
9
+ = f.input :client_count, :input_html => {:size => 12, :style => 'text-align: right'}
10
+ = f.input :expenses, :input_html => {:size => 12, :style => 'text-align: right'}
11
+ = f.input :credit_turnover, :input_html => {:size => 12, :style => 'text-align: right'}
12
+ = f.input :discount, :input_html => {:size => 12, :style => 'text-align: right'}
13
+
14
+ = f.buttons do
15
+ = f.commit_button
@@ -0,0 +1 @@
1
+ page['#cash'].append(@cash)
@@ -0,0 +1,5 @@
1
+ = contextual_links
2
+
3
+ %h2= t_title
4
+
5
+ = render 'form'
@@ -0,0 +1,19 @@
1
+ = contextual_links
2
+
3
+ %h2= t_title
4
+
5
+ = paginated_section @accounts, :params => {:query => params[:query]} do
6
+ %table.list#days_list
7
+ %tr
8
+ %th= t_attr :date
9
+ %th.currency= t_attr :cash
10
+ %th.currency= t_attr :card_turnover
11
+ %th.currency= t_attr :gross_turnover
12
+ %th.currency= t_attr :net_turnover
13
+ %th.currency= t_attr :client_count
14
+ %th.currency= t_attr :expenses
15
+ %th.currency= t_attr :credit_turnover
16
+ %th.currency= t_attr :discount
17
+ %th.action-links
18
+
19
+ = render @days
@@ -0,0 +1,6 @@
1
+ = contextual_links
2
+
3
+ %h1
4
+ = t('crud.title.day.new', :day => @day.date)
5
+
6
+ = render 'complete_form'
@@ -0,0 +1 @@
1
+ page['#days_list'].before(render(:partial => 'complete_form'))
@@ -0,0 +1,35 @@
1
+ = contextual_links
2
+
3
+ %h1= @days
4
+
5
+ %table
6
+ %tr
7
+ %th= t_attr :date
8
+ %td= @day.date.to_date
9
+ %tr
10
+ %th= t_attr :cash
11
+ %td= @day.cash
12
+ %tr
13
+ %th= t_attr :card_turnover
14
+ %td= @day.card_turnover
15
+ %tr
16
+ %th= t_attr :gross_turnover
17
+ %td= @day.gross_turnover
18
+ %tr
19
+ %th= t_attr :net_turnover
20
+ %td= @day.net_turnover
21
+ %tr
22
+ %th= t_attr :client_count
23
+ %td= @day.client_count
24
+ %tr
25
+ %th= t_attr :product_count
26
+ %td= @day.product_count
27
+ %tr
28
+ %th= t_attr :expenses
29
+ %td= @day.expenses
30
+ %tr
31
+ %th= t_attr :credit_turnover
32
+ %td= @day.credit_turnover
33
+ %tr
34
+ %th= t_attr :discount
35
+ %td= @day.discount
@@ -0,0 +1,25 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ day: Tagesabschluss
5
+
6
+ attributes:
7
+ day:
8
+ date: Datum
9
+ cash: Bargeldumsatz
10
+ card_turnover: Kreditkartenumsatz
11
+ expenses: Barausgabe
12
+ gross_turnover: Bruttoumsatz
13
+ net_turnover: Nettoumsatz
14
+ client_count: Anzahl Verkäufe
15
+ product_count: Verkaufte Produkte
16
+ credit_turnover: Kreditumsatz
17
+ discount: Rabatt
18
+ from: Abrechnung von
19
+ total: Total
20
+ calculate: Ausrechnen
21
+
22
+ crud:
23
+ title:
24
+ day:
25
+ new: Abrechnung von %{day}
@@ -0,0 +1,20 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ day: Tagesabschluss
5
+
6
+ attributes:
7
+ day:
8
+ date: Datum
9
+ cash: Bargeldumsatz
10
+ card_turnover: Kreditkartenumsatz
11
+ expenses: Barausgabe
12
+ gross_turnover: Bruttoumsatz
13
+ net_turnover: Nettoumsatz
14
+ client_count: Anzahl Verkäufe
15
+ product_count: Verkaufte Produkte
16
+ credit_turnover: Kreditumsatz
17
+ discount: Rabatt
18
+ from: Abrechnung von
19
+ total: Total
20
+ calculate: Ausrechnen
data/config/routes.rb ADDED
@@ -0,0 +1,8 @@
1
+ Rails.application.routes.draw do
2
+ # Days
3
+ resources :days do
4
+ collection do
5
+ post :calculate_cash
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ require 'bookyt_pos'
2
+ require 'rails'
3
+
4
+ module BookytPos
5
+ class Railtie < Rails::Engine
6
+ end
7
+ end
data/lib/bookyt_pos.rb ADDED
@@ -0,0 +1 @@
1
+ require 'bookyt_pos/railtie' if defined?(::Rails::Railtie)
@@ -0,0 +1,2 @@
1
+ module BookytPos
2
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bookyt_pos
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - "Simon H\xC3\xBCrlimann (CyT)"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-07-24 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Insert BookytPos description.
23
+ email:
24
+ - simon.huerlimann@cyt.ch
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - app/stylesheets/bookyt_pos.sass
33
+ - app/stylesheets/bookyt_pos.sass~
34
+ - app/controllers/days_controller.rb
35
+ - app/controllers/days_controller.rb~
36
+ - app/views/days/new.html.haml
37
+ - app/views/days/_form.html.haml
38
+ - app/views/days/_day.html.haml
39
+ - app/views/days/edit.html.haml
40
+ - app/views/days/show.html.haml
41
+ - app/views/days/new.js.rjs
42
+ - app/views/days/_complete_form.html.haml
43
+ - app/views/days/index.html.haml
44
+ - app/views/days/calculate_cash.js.rjs
45
+ - app/views/days/_calculate.html.haml
46
+ - app/models/day.rb
47
+ - lib/bookyt_pos.rb
48
+ - lib/bookyt_pos/railtie.rb
49
+ - lib/bookyt_pos.rb~
50
+ - config/routes.rb
51
+ - config/locales/de.yml~
52
+ - config/locales/de.yml
53
+ - MIT-LICENSE
54
+ - Rakefile
55
+ - Gemfile
56
+ - README.rdoc
57
+ has_rdoc: true
58
+ homepage: https://github.com/huerlisi/bookyt_pos
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options: []
63
+
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ hash: 3
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements: []
85
+
86
+ rubyforge_project:
87
+ rubygems_version: 1.5.2
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Point of Sale plugin for bookyt.
91
+ test_files: []
92
+