ish_manager 0.1.8.463 → 0.1.8.464
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ish_manager/invoices_controller.rb +37 -93
- data/app/mailers/ish_manager/leadset_mailer.rb +22 -0
- data/app/mailers/ish_manager/office_mailer.rb +1 -1
- data/app/views/ish_manager/invoices/_index_list.haml +7 -1
- data/app/views/ish_manager/leadset_mailer/monthly_invoice.html.erb +6 -0
- data/app/views/ish_manager/leadsets/_form.haml +11 -6
- data/app/views/ish_manager/leadsets/edit.haml +3 -2
- data/app/views/ish_manager/leadsets/new.haml +5 -4
- data/app/views/ish_manager/leadsets/show.haml +4 -2
- data/config/routes.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 129a6f70a1dca0e0a0a6520c9cb3b47e588649c5cbb28c17020f1a05d928de0f
|
4
|
+
data.tar.gz: 6929d2066273ed6ba47f8c3e9528303c7862798238fb0a60470e46f305e295f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df339f9e3bbce4f31231cb70492eec9c43ce3d0678bbb4a58f5154aaa68b907efbd9e986406e7b900da7fd23914566748cc8ed875dd2deffe28e621311f942e7
|
7
|
+
data.tar.gz: 106dabcf7f541a6f46969792718c000e4a2f05719b3eb15063c3f8480ff3b9e56a156bf6315c8d3c5800ee3492c1146347837d36a1c7fac7cea4ef3affd5406b
|
@@ -6,115 +6,50 @@ class ::IshManager::InvoicesController < IshManager::ApplicationController
|
|
6
6
|
before_action :set_lists
|
7
7
|
|
8
8
|
def create_monthly_pdf
|
9
|
+
month_on = DateTime.strptime(params[:month_on], '%Y-%m-%d').strftime('%Y-%m-01')
|
9
10
|
@leadset = Leadset.find params[:leadset_id]
|
10
11
|
authorize! :create_monthly_invoice_pdf, @leadset
|
11
12
|
|
12
|
-
@invoice = Ish::Invoice.where({ leadset_id: @leadset.id, month_on:
|
13
|
-
if @invoice
|
13
|
+
@invoice = Ish::Invoice.where({ leadset_id: @leadset.id, month_on: month_on }).first
|
14
|
+
if @invoice && !params[:replace]
|
14
15
|
flash_alert "Already created this invoice."
|
15
16
|
redirect_to controller: :leadsets, action: :show, id: @leadset.id
|
16
17
|
return
|
17
18
|
end
|
18
19
|
|
19
|
-
|
20
|
+
if !@invoice
|
21
|
+
@invoice = Ish::Invoice.create({
|
22
|
+
leadset_id: @leadset.id,
|
23
|
+
month_on: month_on,
|
24
|
+
number: @leadset.next_invoice_number,
|
25
|
+
})
|
26
|
+
@leadset.update_attributes({ next_invoice_number: @leadset.next_invoice_number + 1 })
|
27
|
+
end
|
20
28
|
|
21
|
-
@pdf = @invoice.generate_monthly_invoice
|
22
|
-
|
23
|
-
path = Rails.root.join 'tmp', filename
|
29
|
+
@pdf = @invoice.generate_monthly_invoice
|
30
|
+
path = Rails.root.join 'tmp', @invoice.filename
|
24
31
|
@pdf.render_file path
|
25
32
|
data = File.read path
|
26
|
-
File.delete(path) if File.exist?(path)
|
27
|
-
|
28
|
-
send_data( data, { :filename => filename,
|
29
|
-
:disposition => params[:disposition] ? params[:disposition] : :attachment,
|
30
|
-
:type => 'application/pdf'
|
31
|
-
})
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
## @TODO: obsolete, remove
|
36
|
-
##
|
37
|
-
def create_pdf
|
38
|
-
@invoice = Ish::Invoice.new
|
39
|
-
authorize! :new, @invoice
|
40
33
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
pdf.fill_rectangle [0, 792], 612, 792
|
52
|
-
end
|
53
|
-
pdf.fill_color '000000'
|
54
|
-
|
55
|
-
pdf.image wasya_co_logo_url, at: [252, 720], width: 108 ## 1.5"
|
56
|
-
|
57
|
-
pdf.bounding_box( [0.75*72, 9.25*72], width: 3.25*72, height: 0.75*72 ) do
|
58
|
-
pdf.text "From:"
|
59
|
-
pdf.text "Wasya Co"
|
60
|
-
pdf.text "(415) 948-0368"
|
61
|
-
end
|
62
|
-
|
63
|
-
pdf.bounding_box( [4.5*72, 9.25*72], width: 3.25*72, height: 0.75*72 ) do
|
64
|
-
pdf.text "Stats:"
|
65
|
-
pdf.text "Date: #{ '2023-09-07' }"
|
66
|
-
pdf.text "Invoice # #{ '111' }"
|
67
|
-
end
|
68
|
-
|
69
|
-
pdf.bounding_box( [0.75*72, 8.25*72], width: 3.25*72, height: 0.75*72 ) do
|
70
|
-
pdf.text "To:"
|
71
|
-
pdf.text "Creen Enterprise"
|
72
|
-
end
|
73
|
-
|
74
|
-
pdf.bounding_box( [4.5*72, 8.25*72], width: 3.25*72, height: 0.75*72 ) do
|
75
|
-
pdf.text "Notes:"
|
76
|
-
pdf.text "Support & various, for the month of August '23."
|
77
|
-
end
|
78
|
-
|
79
|
-
pdf.move_down 20
|
80
|
-
|
81
|
-
pdf.table([
|
82
|
-
[ 'Description', 'Type', 'Hours', 'Subtotal' ],
|
83
|
-
[ 'Part 2/2', 'indep. proj.', '-', '$3,501' ],
|
84
|
-
], {
|
85
|
-
position: :center,
|
86
|
-
width: 7.5*72,
|
87
|
-
cell_style: {
|
88
|
-
inline_format: true,
|
89
|
-
borders: [ :bottom ]
|
90
|
-
},
|
91
|
-
} )
|
92
|
-
|
93
|
-
pdf.table([
|
94
|
-
[ 'Total' ],
|
95
|
-
[ '$3,501' ],
|
96
|
-
], {
|
97
|
-
position: 7*72,
|
98
|
-
width: 1*72,
|
99
|
-
cell_style: {
|
100
|
-
inline_format: true,
|
101
|
-
borders: [ :bottom ]
|
102
|
-
},
|
103
|
-
} )
|
104
|
-
|
105
|
-
pdf.text_box "Thank you!", at: [ 3.25*72, 1.25*72 ], width: 2*72, height: 1*72, align: :center
|
34
|
+
asset = ::Gameui::Asset3d.new invoice: @invoice
|
35
|
+
f = File.new( path )
|
36
|
+
asset.object = f
|
37
|
+
f.close
|
38
|
+
@invoice.asset = asset
|
39
|
+
if asset.save
|
40
|
+
flash_notice "Saved the asset."
|
41
|
+
end
|
42
|
+
if @invoice.save
|
43
|
+
flash_notice "Saved the invoice."
|
106
44
|
end
|
107
45
|
|
108
|
-
filename = "a-summary.pdf"
|
109
|
-
path = Rails.root.join 'tmp', filename
|
110
|
-
pdf.render_file path
|
111
|
-
data = File.read path
|
112
46
|
File.delete(path) if File.exist?(path)
|
47
|
+
redirect_to controller: :leadsets, action: :show, id: @invoice.leadset_id
|
113
48
|
|
114
|
-
send_data( data, { :filename => filename,
|
115
|
-
|
116
|
-
|
117
|
-
})
|
49
|
+
# send_data( data, { :filename => @invoice.filename,
|
50
|
+
# :disposition => params[:disposition] ? params[:disposition] : :attachment,
|
51
|
+
# :type => 'application/pdf'
|
52
|
+
# })
|
118
53
|
end
|
119
54
|
|
120
55
|
def create_stripe
|
@@ -170,6 +105,15 @@ class ::IshManager::InvoicesController < IshManager::ApplicationController
|
|
170
105
|
@products_list = Wco::Product.list
|
171
106
|
end
|
172
107
|
|
108
|
+
def email_send
|
109
|
+
@invoice = Ish::Invoice.find params[:id]
|
110
|
+
authorize! :send_email, @invoice
|
111
|
+
out = ::IshManager::LeadsetMailer.monthly_invoice( @invoice.id )
|
112
|
+
Rails.env.production? ? out.deliver_later : out.deliver_now
|
113
|
+
flash_notice "Scheduled to send an email."
|
114
|
+
redirect_to controller: :leadsets, action: :show, id: @invoice.leadset_id
|
115
|
+
end
|
116
|
+
|
173
117
|
def show
|
174
118
|
@invoice = Ish::Invoice.find params[:id]
|
175
119
|
authorize! :show, @invoice
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
class IshManager::LeadsetMailer < IshManager::ApplicationMailer
|
4
|
+
default from: 'WasyaCo Consulting <hello@wasya.co>'
|
5
|
+
|
6
|
+
# layout 'mailer'
|
7
|
+
|
8
|
+
def monthly_invoice invoice_id
|
9
|
+
@invoice = ::Ish::Invoice.find invoice_id
|
10
|
+
@leadset = @invoice.leadset
|
11
|
+
|
12
|
+
path = Rails.root.join 'tmp', @invoice.filename
|
13
|
+
download = open( @invoice.asset.object.url(:original) )
|
14
|
+
IO.copy_stream( download, path )
|
15
|
+
attachments[@invoice.filename] = File.read( path )
|
16
|
+
|
17
|
+
mail( to: @leadset.email,
|
18
|
+
subject: "WasyaCo invoice for #{@invoice.month_on.strftime('%B')}",
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
class IshManager::OfficeMailer < IshManager::ApplicationMailer
|
3
|
-
default from: 'WasyaCo Consulting & Software Development <
|
3
|
+
default from: 'WasyaCo Consulting & Software Development <no-reply@mail.wasyaco.com>'
|
4
4
|
|
5
5
|
## 2023-04-02 _vp_ Continue.
|
6
6
|
def send_context_email ctx_id
|
@@ -6,18 +6,23 @@
|
|
6
6
|
.input-field
|
7
7
|
= f.label :company_url
|
8
8
|
= f.text_field :company_url
|
9
|
+
|
9
10
|
.input-field
|
10
11
|
= f.label :name
|
11
12
|
= f.text_field :name
|
13
|
+
|
12
14
|
.input-field
|
13
15
|
= f.label :email
|
14
16
|
= f.text_field :email
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
|
18
|
+
.input-field
|
19
|
+
= f.label :next_invoice_number
|
20
|
+
= f.text_field :next_invoice_number
|
21
|
+
|
22
|
+
.input-field
|
23
|
+
%label Stripe customer_id
|
24
|
+
= f.text_field :customer_id
|
25
|
+
|
21
26
|
.actions
|
22
27
|
= f.submit
|
23
28
|
|
@@ -31,9 +31,11 @@
|
|
31
31
|
= render 'ish_manager/invoices/index_list', invoices: @invoices
|
32
32
|
|
33
33
|
= form_tag create_monthly_invoice_for_leadset_path({ leadset_id: @leadset.id }) do
|
34
|
-
%label
|
34
|
+
%label Invoice for month
|
35
35
|
= text_field_tag 'month_on'
|
36
|
-
|
36
|
+
%label (x?)
|
37
|
+
= check_box_tag 'replace'
|
38
|
+
= submit_tag '>', data: { confirm: 'Are you sure?' }
|
37
39
|
%hr
|
38
40
|
|
39
41
|
.col-md-6
|
data/config/routes.rb
CHANGED
@@ -25,6 +25,7 @@ IshManager::Engine.routes.draw do
|
|
25
25
|
|
26
26
|
get 'image_assets', to: 'image_assets#index', as: :image_assets
|
27
27
|
|
28
|
+
post 'invoices/send/:id', to: 'invoices#email_send', as: :send_invoice
|
28
29
|
post 'invoices/create-monthly-for/:leadset_id', to: 'invoices#create_monthly_pdf', as: :create_monthly_invoice_for_leadset
|
29
30
|
post 'invoices/create-pdf', to: 'invoices#create_pdf', as: :create_invoice_pdf
|
30
31
|
post 'invoices/create-stripe', to: 'invoices#create_stripe', as: :create_invoice_stripe
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ish_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.464
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -525,6 +525,7 @@ files:
|
|
525
525
|
- app/jobs/ish_manager/email_campaign_job.rb-trash
|
526
526
|
- app/jobs/ish_manager/test_email_job.rb
|
527
527
|
- app/mailers/ish_manager/application_mailer.rb
|
528
|
+
- app/mailers/ish_manager/leadset_mailer.rb
|
528
529
|
- app/mailers/ish_manager/meeting_mailer.rb
|
529
530
|
- app/mailers/ish_manager/office_mailer.rb
|
530
531
|
- app/mailers/ish_manager/offier_mailer.rb-trash
|
@@ -727,6 +728,7 @@ files:
|
|
727
728
|
- app/views/ish_manager/leads/index.haml
|
728
729
|
- app/views/ish_manager/leads/new.haml
|
729
730
|
- app/views/ish_manager/leads/show.haml
|
731
|
+
- app/views/ish_manager/leadset_mailer/monthly_invoice.html.erb
|
730
732
|
- app/views/ish_manager/leadsets/_form.haml
|
731
733
|
- app/views/ish_manager/leadsets/edit.haml
|
732
734
|
- app/views/ish_manager/leadsets/index.haml
|