clinvoice 0.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eff81d0c1a0f9c5a8033da37503a1a46c6a73e91700da9a54d5886cc77d9ab7
4
- data.tar.gz: 51f4abdbc6be6ae18a0f062a674dfe9dfbbef2a05c0b93e38df35bebb746d2fa
3
+ metadata.gz: a7b30b68da884dd446548d727a619dff2267e2b0489766d55f71112248031bf6
4
+ data.tar.gz: 5240d5bc15516f3384cc6fff5718fcdea563eb1fa82e9c5b60c754eaf8d1e269
5
5
  SHA512:
6
- metadata.gz: 2f2e656c9852fdbf7beef5de6513a7f461e64f9364a991b478edab23308ba60c606d69a69d3d2e340bce0df5510c53e38c403586f05bb9193ef2d4d54e90d5e3
7
- data.tar.gz: 14deaa3280ba174560972b00f096f5f894784a9015bfbb32f1e11c59b57c925ee0ea61cad71f96f814b56d499fc1238e87f3e67209c8bc9aa98647bccff607b6
6
+ metadata.gz: 21098285d4623b2a9bd6f692073c9454751c00f941bb0047dbf710701612e4214617a3bed839b90108fb9fa9619c96a1d730ea8592a6d21aca31164c678c9ece
7
+ data.tar.gz: 1f8b1bb9dd0f69008198ca0b2365b0564da3fa2ec27f8c1e882a8c582ff87a4f4ba61ffbc3aadc6d0df54b3e833e8cff55508027edf0adc58eee7b3ffadb7d89
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.pdf
13
+ *.yml
14
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at andrewaguiar6@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in clinvoice.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,29 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ clinvoice (1.0.0)
5
+ prawn (~> 2.2)
6
+ prawn-table (~> 0.2.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ pdf-core (0.7.0)
12
+ prawn (2.2.2)
13
+ pdf-core (~> 0.7.0)
14
+ ttfunk (~> 1.5)
15
+ prawn-table (0.2.2)
16
+ prawn (>= 1.3.0, < 3.0.0)
17
+ rake (10.5.0)
18
+ ttfunk (1.5.1)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ bundler (~> 1.16)
25
+ clinvoice!
26
+ rake (~> 10.0)
27
+
28
+ BUNDLED WITH
29
+ 1.16.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Andrew S Aguiar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # Clinvoice
2
+
3
+ Generates invoices using command line based on yaml files
4
+
5
+ ```shell
6
+ clinvoice init <datafile> # starts a new template with id 1 and empty entries.
7
+ clinvoice new <filename> # generates a pdf invoice based on a data file `yml`.
8
+ clinvoice next <datafile> # generates the next data file `yml`.
9
+ ```
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'clinvoice'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install clinvoice
26
+
27
+ ## Usage
28
+
29
+ 1 - Create a new client template:
30
+
31
+ $ clinvoice init doge-client
32
+
33
+ This will create a `doge-client-1.yml` data file.
34
+
35
+ ```yaml
36
+ data:
37
+ id: 1
38
+ currency: "USD"
39
+ contractor:
40
+ name: "You"
41
+ address:
42
+ line1: "123, Street, 451233"
43
+ line2: "City, State, Country"
44
+ client:
45
+ name: "Your Client"
46
+ address:
47
+ line1: "123, Street, 451233"
48
+ line2: "City, State, Country"
49
+ items:
50
+ -
51
+ description: "Example service 1"
52
+ quantity: 1
53
+ unit_cost: 1.00
54
+ -
55
+ description: "Example service 2"
56
+ quantity: 1
57
+ unit_cost: 2.00
58
+ notes: "footer notes optional"
59
+ ```
60
+
61
+ 2 - Edit the data file:
62
+
63
+ $ vim doge-client-1.yml
64
+
65
+ 3 - Now we can generate our pdf invoice based on the data file
66
+
67
+ $ clinvoice new doge-client-1
68
+
69
+ This will create a `doge-client-1.pdf` file based on the data file `doge-client-1.yml`.
70
+
71
+ 4 - Generate a next datafile
72
+
73
+ $ clinvoice next doge-client
74
+
75
+ This will create a `doge-client-2.yml` data file, based on the last data file id + 1.
76
+
77
+ ## Development
78
+
79
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
80
+
81
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
82
+
83
+ ## Contributing
84
+
85
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/clinvoice. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
86
+
87
+ ## License
88
+
89
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
90
+
91
+ ## Code of Conduct
92
+
93
+ Everyone interacting in the Clinvoice project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/clinvoice/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/clinvoice ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'clinvoice'
5
+
6
+ Clinvoice.execute(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/clinvoice.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require 'clinvoice/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'clinvoice'
10
+ spec.version = Clinvoice::VERSION
11
+ spec.authors = ['Andrew S Aguiar']
12
+ spec.email = ['andrewaguiar6@gmail.com']
13
+ spec.summary = 'Generates invoices using command line'
14
+ spec.description = 'Generates invoices using command line based on yaml file'
15
+ spec.homepage = 'https://github.com/andrewaguiar/clinvoice'
16
+ spec.license = 'MIT'
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
21
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ end
23
+
24
+ spec.bindir = 'bin'
25
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
+ spec.require_paths = ['lib']
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.16'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_dependency 'prawn', '~> 2.2'
31
+ spec.add_dependency 'prawn-table', '~> 0.2.2'
32
+ end
data/generate-gem ADDED
@@ -0,0 +1,4 @@
1
+
2
+ rm *.gem
3
+ gem build clinvoice.gemspec
4
+
data/lib/clinvoice.rb ADDED
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'clinvoice/initialize_template'
4
+ require 'clinvoice/generate_pdf'
5
+ require 'clinvoice/version'
6
+
7
+ module Clinvoice
8
+ def self.execute(args)
9
+ show_usage_and_exit! if args.empty?
10
+
11
+ command = args[0]
12
+ file = args[1]
13
+
14
+ case command
15
+ when 'init'
16
+ Clinvoice::InitializeTemplate.call(file)
17
+ when 'new'
18
+ Clinvoice::GeneratePDF.call(file)
19
+ else
20
+ show_usage_and_exit!
21
+ end
22
+ end
23
+
24
+ def self.show_usage_and_exit!
25
+ puts <<~USAGE
26
+ Usage:
27
+
28
+ clinvoice init <datafile> # starts a new template with id 1 and empty entries.
29
+ clinvoice new <filename> # generates a pdf invoice based on a data file `yml`.
30
+
31
+ Args:
32
+
33
+ - datafile: the yaml template without number and extention, example 'doge' ('doge-*.yml' templates)
34
+ - filename: the yaml template with number but without extention, example 'doge-3' ('doge-3.yml' templates)
35
+
36
+ Examples / Flow:
37
+
38
+ 1 - First lets create a new client template:
39
+
40
+ `$ clinvoice init doge-client`
41
+
42
+ This will create a `doge-client-1.yml` data file, lets edit it and generate our pdf invoice.
43
+
44
+ 2 - Edit the data file:
45
+
46
+ `$ vim doge-client-1.yml`
47
+
48
+ 3 - Now we can generate our pdf invoice based on the data file
49
+
50
+ `$ clinvoice new doge-client-1`
51
+
52
+ This will create a `doge-client-1.pdf` file based on the data file `doge-client-1.yml`.
53
+
54
+ USAGE
55
+
56
+ exit
57
+ end
58
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ module Clinvoice
6
+ class Data
7
+ attr_reader :invoice_id,
8
+ :currency,
9
+ :contractor,
10
+ :client,
11
+ :items,
12
+ :notes,
13
+ :total,
14
+ :file
15
+
16
+ def initialize(file)
17
+ filename = file.end_with?('.yml') ? file : "#{file}.yml"
18
+
19
+ data = YAML.load_file(filename)['data']
20
+
21
+ @file = file
22
+ @invoice_id = data['id']
23
+ @currency = data['currency']
24
+ @issue_date = data['issue_date']
25
+ @contractor = data['contractor']
26
+ @client = data['client']
27
+ @items = data['items'].map do |item|
28
+ [
29
+ item['description'],
30
+ item['unit_cost'],
31
+ item['quantity'],
32
+ item['quantity'] * item['unit_cost']
33
+ ]
34
+ end
35
+
36
+ @notes = data['notes']
37
+ @total = @items.map(&:last).sum
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'prawn'
4
+ require 'prawn/table'
5
+ require 'clinvoice/data'
6
+ require 'clinvoice/helper'
7
+ require 'clinvoice/render_basic_info'
8
+ require 'clinvoice/render_name_and_address'
9
+ require 'clinvoice/render_items'
10
+ require 'clinvoice/render_notes'
11
+ require 'clinvoice/render_title'
12
+ require 'clinvoice/render_total'
13
+
14
+ module Clinvoice
15
+ module GeneratePDF
16
+ def self.call(file)
17
+ data = Clinvoice::Data.new(file)
18
+
19
+ Prawn::Document.generate("#{data.file}.pdf") do |pdf|
20
+ Prawn::Font::AFM.hide_m17n_warning = true
21
+
22
+ pdf.font 'Helvetica'
23
+
24
+ Clinvoice::RenderTitle.call(pdf)
25
+
26
+ pdf.font_size 9
27
+
28
+ Clinvoice::RenderBasicInfo.call(pdf, data)
29
+ Clinvoice::RenderNameAndAddress.call(pdf, 'From', data.contractor)
30
+ Clinvoice::RenderNameAndAddress.call(pdf, 'To', data.client)
31
+ Clinvoice::RenderItems.call(pdf, data.items)
32
+ Clinvoice::RenderTotal.call(pdf, data.total)
33
+ Clinvoice::RenderNotes.call(pdf, data.notes)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module Helper
5
+ def self.format_currency(number)
6
+ format('$%.2f', number.to_f)
7
+ end
8
+
9
+ def self.new_line(pdf, text)
10
+ pdf.text_box text.to_s, at: [8, pdf.cursor]
11
+ pdf.move_down 12
12
+ end
13
+
14
+ def self.new_bold_line(pdf, text)
15
+ pdf.font 'Helvetica', style: :bold
16
+ pdf.text_box text.to_s, at: [8, pdf.cursor]
17
+ pdf.font 'Helvetica', style: :normal
18
+ pdf.move_down 12
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module InitializeTemplate
5
+ def self.call(file)
6
+ template_content = <<~TEMPLATE
7
+ data:
8
+ id: 1
9
+ currency: "USD"
10
+ contractor:
11
+ name: "You"
12
+ address:
13
+ line1: "123, Street, 451233"
14
+ line2: "City, State, Country"
15
+ client:
16
+ name: "Your Client"
17
+ address:
18
+ line1: "123, Street, 451233"
19
+ line2: "City, State, Country"
20
+ items:
21
+ -
22
+ description: "Example service 1"
23
+ quantity: 1
24
+ unit_cost: 1.00
25
+ -
26
+ description: "Example service 2"
27
+ quantity: 1
28
+ unit_cost: 2.00
29
+ notes: "footer notes optional"
30
+ TEMPLATE
31
+
32
+ File.write("#{file}-1.yml", template_content)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module RenderBasicInfo
5
+ def self.call(pdf, data)
6
+ Clinvoice::Helper.new_bold_line(pdf, "Invoice ID")
7
+ Clinvoice::Helper.new_line(pdf, data.invoice_id)
8
+
9
+ pdf.move_down 10
10
+
11
+ Clinvoice::Helper.new_bold_line(pdf, "Currency")
12
+ Clinvoice::Helper.new_line(pdf, data.currency)
13
+
14
+ pdf.move_down 10
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module RenderItems
5
+ def self.call(pdf, data_items)
6
+ pdf.move_down 20
7
+
8
+ pdf.table(items(data_items), width: pdf.bounds.width) do
9
+ style(row(1..-1).columns(0..-1), padding: [4, 5, 4, 5], borders: [:bottom], border_color: 'dddddd')
10
+ style(row(0), background_color: 'e9e9e9', border_color: 'dddddd', font_style: :bold)
11
+ style(row(0).columns(0..-1), borders: %i[top bottom])
12
+ style(row(0).columns(0), borders: %i[top left bottom])
13
+ style(row(0).columns(-1), borders: %i[top right bottom])
14
+ style(row(-1), border_width: 2)
15
+ style(column(2..-1), align: :right)
16
+ style(columns(0), width: 280)
17
+ end
18
+
19
+ pdf.move_down 10
20
+ end
21
+
22
+ private
23
+
24
+ def self.items(data_items)
25
+ header = ['Description', 'Unit Cost', 'Quantity', 'Line Total']
26
+ blank_line = [' ', ' ', ' ', ' ']
27
+
28
+ [header] + formatted_items(data_items) + [blank_line]
29
+ end
30
+
31
+ def self.formatted_items(items)
32
+ items.map do |item|
33
+ [
34
+ item[0],
35
+ Clinvoice::Helper.format_currency(item[1]),
36
+ item[2],
37
+ Clinvoice::Helper.format_currency(item[3])
38
+ ]
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module RenderNameAndAddress
5
+ def self.call(pdf, label, entity)
6
+ Clinvoice::Helper.new_bold_line(pdf, label)
7
+ Clinvoice::Helper.new_line(pdf, entity['name'])
8
+
9
+ if entity['address']
10
+ Clinvoice::Helper.new_line(pdf, entity['address']['line1'])
11
+ Clinvoice::Helper.new_line(pdf, entity['address']['line2'])
12
+ end
13
+
14
+ pdf.move_down 10
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module RenderNotes
5
+ def self.call(pdf, notes)
6
+ return unless notes
7
+
8
+ pdf.table(items(notes), width: 275) do
9
+ style(row(0).columns(0), font_style: :bold)
10
+ style(row(0..-1).columns(0..-1), padding: [1, 0, 1, 0], borders: [])
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ def self.items(notes)
17
+ [['Notes'], [notes]]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module RenderTitle
5
+ def self.call(pdf)
6
+ pdf.move_down 5
7
+
8
+ pdf.font 'Helvetica', style: :bold
9
+ pdf.font_size 20
10
+ pdf.text_box 'INVOICE', at: [230, pdf.cursor]
11
+ pdf.font 'Helvetica', style: :normal
12
+
13
+ pdf.move_down 30
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ module RenderTotal
5
+ def self.call(pdf, total)
6
+ pdf.table(items(total), position: 425, width: 115) do
7
+ style(row(0), font_style: :bold)
8
+ style(row(0), background_color: 'e9e9e9', border_color: 'dddddd', font_style: :bold)
9
+ style(column(1), align: :right)
10
+ style(row(0..1).columns(0..1), padding: [3, 5, 3, 5], borders: [])
11
+ end
12
+
13
+ pdf.move_down 25
14
+ end
15
+
16
+ private
17
+
18
+ def self.items(total)
19
+ [['Total', Clinvoice::Helper.format_currency(total)]]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Clinvoice
4
+ VERSION = '2.1.1'
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clinvoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew S Aguiar
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-18 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,15 +69,42 @@ dependencies:
69
69
  description: Generates invoices using command line based on yaml file
70
70
  email:
71
71
  - andrewaguiar6@gmail.com
72
- executables: []
72
+ executables:
73
+ - clinvoice
74
+ - setup
73
75
  extensions: []
74
76
  extra_rdoc_files: []
75
- files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - CODE_OF_CONDUCT.md
82
+ - Gemfile
83
+ - Gemfile.lock
84
+ - LICENSE.txt
85
+ - README.md
86
+ - Rakefile
87
+ - bin/clinvoice
88
+ - bin/setup
89
+ - clinvoice.gemspec
90
+ - generate-gem
91
+ - lib/clinvoice.rb
92
+ - lib/clinvoice/data.rb
93
+ - lib/clinvoice/generate_pdf.rb
94
+ - lib/clinvoice/helper.rb
95
+ - lib/clinvoice/initialize_template.rb
96
+ - lib/clinvoice/render_basic_info.rb
97
+ - lib/clinvoice/render_items.rb
98
+ - lib/clinvoice/render_name_and_address.rb
99
+ - lib/clinvoice/render_notes.rb
100
+ - lib/clinvoice/render_title.rb
101
+ - lib/clinvoice/render_total.rb
102
+ - lib/clinvoice/version.rb
76
103
  homepage: https://github.com/andrewaguiar/clinvoice
77
104
  licenses:
78
105
  - MIT
79
106
  metadata: {}
80
- post_install_message:
107
+ post_install_message:
81
108
  rdoc_options: []
82
109
  require_paths:
83
110
  - lib
@@ -92,9 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
119
  - !ruby/object:Gem::Version
93
120
  version: '0'
94
121
  requirements: []
95
- rubyforge_project:
96
- rubygems_version: 2.7.3
97
- signing_key:
122
+ rubygems_version: 3.1.4
123
+ signing_key:
98
124
  specification_version: 4
99
125
  summary: Generates invoices using command line
100
126
  test_files: []