print_clerk 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -8
- data/app/assets/javascripts/print_office.js.coffee +11 -0
- data/app/assets/stylesheets/print_office.css +169 -0
- data/app/controllers/baskets_controller_decorator.rb +7 -0
- data/app/controllers/orders_decorator.rb +14 -9
- data/app/controllers/product_controller_decorator.rb +44 -0
- data/app/helpers/orders_helper_decorator.rb +8 -0
- data/app/views/baskets/button_list.haml +1 -0
- data/app/views/orders/_invoice_address.haml +11 -11
- data/app/views/orders/_invoice_footer.haml +12 -7
- data/app/views/orders/_invoice_header.haml +11 -9
- data/app/views/orders/_invoice_items.haml +6 -12
- data/app/views/orders/_invoice_thanks.haml +4 -15
- data/app/views/orders/_invoice_totals.haml +1 -1
- data/app/views/orders/_receipt_footer.haml +2 -0
- data/app/views/orders/_receipt_header.haml +3 -3
- data/app/views/orders/button_list.haml +2 -0
- data/app/views/orders/invoice.haml +20 -23
- data/app/views/orders/receipt.haml +45 -52
- data/app/views/products/barcode_button.haml +2 -0
- data/config/routes.rb +12 -0
- data/lib/print_clerk.rb +10 -5
- metadata +63 -11
- data/app/assets/stylesheets/print-invoice.css +0 -140
- data/app/assets/stylesheets/print-receipt.css.scss +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a817456208ff0bfc79c7844bbe262bce961e72aa
|
4
|
+
data.tar.gz: 8e15e1eec039783d9d35696f21ba46e72335fe4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 517f34477fe53141cae866d4a6b82389b4d10822983753adf3c83b63abdc5d129ee6ab5a040cee2d7d88109174c9b87b1139ade118080530eed924af748a07ef
|
7
|
+
data.tar.gz: 20e90ed180a8cf0de0bf104bf0690ac3cac9996f30c37ba32388eaf776a6e3f022f7cd66752b5637753f712d9fa89796d58e26472b92957c5de263ed747906e1
|
data/README.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/rubyclerks/print_clerk.svg?branch=master)](https://travis-ci.org/rubyclerks/print_clerk)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/print_clerk.svg)](http://badge.fury.io/rb/print_clerk)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/rubyclerks/print_clerk/badges/gpa.svg)](https://codeclimate.com/github/rubyclerks/print_clerk)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/rubyclerks/print_clerk/badges/coverage.svg)](https://codeclimate.com/github/rubyclerks/print_clerk)
|
5
|
+
|
1
6
|
SUMMARY
|
2
7
|
=======
|
3
8
|
|
4
|
-
This extension provides a "Print Invoice" button on the Orders view screen which opens a printable html page with the order details.
|
9
|
+
This extension provides a "Print Invoice" button on the Orders view screen which opens a printable html page with the order details. Actually sevaral stypes are supported and it is easy to add more or edit existing.
|
5
10
|
|
6
11
|
You have to set up your computer for printing, or PDF generation. Off course, if you cave a mac that is as easy as pressing the print + save as pdf buttons.
|
7
12
|
|
@@ -10,8 +15,8 @@ INSTALLATION
|
|
10
15
|
|
11
16
|
1. To install you need to add the following lines to your Gemfile (no external dependencies)
|
12
17
|
|
13
|
-
gem 'print_clerk'
|
14
|
-
|
18
|
+
gem 'print_clerk'
|
19
|
+
|
15
20
|
2. run bundler
|
16
21
|
|
17
22
|
bundle
|
@@ -26,9 +31,9 @@ Configuration
|
|
26
31
|
|
27
32
|
The templates are split into quite small chunks that you can just replace with your own.
|
28
33
|
|
29
|
-
|
34
|
+
Texts are stored in locale files
|
30
35
|
|
31
|
-
1. Set the logo path preference to include your store / company logo.
|
36
|
+
1. Set the logo path preference to include your store / company logo in locales/config.yml
|
32
37
|
|
33
38
|
invoice_logo_path: "company-logo.png"
|
34
39
|
|
@@ -36,12 +41,13 @@ Some texts are stored in locale files say print.yml
|
|
36
41
|
|
37
42
|
2. Override any of the partial templates. they are address, footer, totals, header, thanks , and the items. The whole tanks is wrapped in a thanks hook, so replace or add at will.
|
38
43
|
|
39
|
-
4.
|
44
|
+
4. Disable any styles by changing the config.yml to suit
|
40
45
|
|
41
|
-
|
46
|
+
print_styles: "receipt slip invoice reminder"
|
42
47
|
|
43
|
-
|
48
|
+
For each style there will be a button on the order/show page
|
44
49
|
|
50
|
+
5. Go through the templates and see what you need to change.
|
45
51
|
|
46
52
|
Extra
|
47
53
|
=====
|
@@ -0,0 +1,11 @@
|
|
1
|
+
if gon.order_id
|
2
|
+
jQuery.ajax(url: "/orders/" + gon.order_id + "/button_list.html").done (html) ->
|
3
|
+
$(".order_show_back").append html
|
4
|
+
|
5
|
+
if gon.product_id
|
6
|
+
jQuery.ajax(url: "/products/" + gon.product_id + "/barcode_button.html").done (html) ->
|
7
|
+
$(".product_show_row_end").append html
|
8
|
+
|
9
|
+
if gon.basket_id
|
10
|
+
jQuery.ajax(url: "/baskets/" + gon.basket_id + "/button_list.html").done (html) ->
|
11
|
+
$(".basket_show_end").append html
|
@@ -0,0 +1,169 @@
|
|
1
|
+
@page {
|
2
|
+
margin-left:8mm;
|
3
|
+
margin-right:8mm;
|
4
|
+
margin-top:8mm;
|
5
|
+
margin-bottom:8mm;
|
6
|
+
}
|
7
|
+
|
8
|
+
.receipt {
|
9
|
+
font-family:"Trebuchet MS";
|
10
|
+
font-size:32px;
|
11
|
+
color:#000000;
|
12
|
+
width: 700px;
|
13
|
+
}
|
14
|
+
|
15
|
+
|
16
|
+
div#receipt-header {
|
17
|
+
text-align: center;
|
18
|
+
padding: 6px;
|
19
|
+
line-height: 1.3;
|
20
|
+
width: 700px;
|
21
|
+
}
|
22
|
+
|
23
|
+
#receipt-header img {
|
24
|
+
max-width: 670px;
|
25
|
+
}
|
26
|
+
|
27
|
+
.receipt-shop { font-weight: bold; font-size: 40px; line-height: 1.2;}
|
28
|
+
.receipt-info { padding: 6px; font-size: 30px; text-align: center; line-height: 1.3; width: 700px;}
|
29
|
+
|
30
|
+
.receipt-line_items {
|
31
|
+
width: 700px;
|
32
|
+
}
|
33
|
+
|
34
|
+
div.receipt-wrapper {
|
35
|
+
width: 700px;
|
36
|
+
padding-top: 48px;
|
37
|
+
text-align: left;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.receipt-totals {
|
41
|
+
margin-bottom: 20px;
|
42
|
+
padding: 6px;
|
43
|
+
}
|
44
|
+
|
45
|
+
table.receipt-totals {
|
46
|
+
width: 700px;
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
.receipt-cell.receipt-total {
|
51
|
+
text-align: right;
|
52
|
+
}
|
53
|
+
|
54
|
+
.receipt-cel1 {
|
55
|
+
width: 200px;
|
56
|
+
}
|
57
|
+
|
58
|
+
.receipt-cel2 {
|
59
|
+
width: 80px;
|
60
|
+
}
|
61
|
+
|
62
|
+
|
63
|
+
div.receipt-footer {
|
64
|
+
width: 700px;
|
65
|
+
padding: 6px;
|
66
|
+
text-align: center;
|
67
|
+
}
|
68
|
+
|
69
|
+
.receipt-footer .bold {
|
70
|
+
width: 100px;
|
71
|
+
}
|
72
|
+
.receipt-footer .receipt-cell {
|
73
|
+
width: 220px;
|
74
|
+
}
|
75
|
+
|
76
|
+
.invoice {
|
77
|
+
font-size: 12px; }
|
78
|
+
|
79
|
+
|
80
|
+
.invoice .sender {
|
81
|
+
margin-left: 28px;
|
82
|
+
margin-bottom: 5px;
|
83
|
+
}
|
84
|
+
|
85
|
+
.invoice img#logo {
|
86
|
+
width: 300px; }
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
.invoice .address {
|
92
|
+
border-top:1px dotted grey;
|
93
|
+
margin-bottom: 10px;
|
94
|
+
padding: 6px;
|
95
|
+
}
|
96
|
+
|
97
|
+
.invoice table {
|
98
|
+
background: none;
|
99
|
+
}
|
100
|
+
|
101
|
+
.invoice .wrapper {
|
102
|
+
min-height: 540px;
|
103
|
+
border-top:1px dotted grey;
|
104
|
+
padding: 6px;
|
105
|
+
margin-top: 20px;
|
106
|
+
padding-top: 20px;
|
107
|
+
}
|
108
|
+
|
109
|
+
.invoice .items td {
|
110
|
+
padding-right: 15px;
|
111
|
+
}
|
112
|
+
|
113
|
+
.invoice .items .sku {
|
114
|
+
width: 120px;
|
115
|
+
}
|
116
|
+
.invoice .items .desc {
|
117
|
+
width: 330px;
|
118
|
+
}
|
119
|
+
.invoice .items .price, .total {
|
120
|
+
width: 100px;
|
121
|
+
}
|
122
|
+
.invoice .items .qty {
|
123
|
+
width: 60px;
|
124
|
+
}
|
125
|
+
|
126
|
+
|
127
|
+
.invoice .totals {
|
128
|
+
margin-bottom: 20px;
|
129
|
+
float: right;
|
130
|
+
margin-right: 15px;
|
131
|
+
|
132
|
+
}
|
133
|
+
|
134
|
+
.invoice .totals .cel1 {
|
135
|
+
width: 100px;
|
136
|
+
}
|
137
|
+
.invoice .totals .cel2 {
|
138
|
+
width: 130px;
|
139
|
+
}
|
140
|
+
|
141
|
+
.invoice .thanks {
|
142
|
+
margin-top: 20px;
|
143
|
+
margin-bottom: 20px;
|
144
|
+
}
|
145
|
+
|
146
|
+
.invoice .footer {
|
147
|
+
border-top:1px dotted grey;
|
148
|
+
padding-top: 8px;
|
149
|
+
font-size: 11px;
|
150
|
+
.col-xs-4 { padding-left: 0px; }
|
151
|
+
}
|
152
|
+
|
153
|
+
.invoice .footer .bold {
|
154
|
+
width: 100px;
|
155
|
+
}
|
156
|
+
|
157
|
+
.invoice .title { font-weight: bold; color: #FF9933; font-size: 18px; }
|
158
|
+
.invoice .bold { font-weight: bold; }
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
@media screen {
|
163
|
+
.invoice {max-width: 690px;}
|
164
|
+
|
165
|
+
|
166
|
+
}
|
167
|
+
|
168
|
+
|
169
|
+
|
@@ -1,30 +1,35 @@
|
|
1
1
|
# encoding : utf-8
|
2
2
|
OrdersController.class_eval do
|
3
3
|
|
4
|
-
def
|
4
|
+
def button_list
|
5
5
|
load_order
|
6
|
-
@invoice = true
|
7
|
-
@template = "invoice"
|
8
6
|
render :layout => false
|
9
7
|
end
|
10
8
|
|
11
9
|
def receipt
|
12
10
|
load_order
|
13
|
-
render :layout => false
|
14
11
|
end
|
15
|
-
|
12
|
+
|
13
|
+
def invoice
|
14
|
+
load_order
|
15
|
+
@invoice = true
|
16
|
+
@template = "invoice"
|
17
|
+
end
|
18
|
+
|
19
|
+
# slip is an invoice without prices
|
16
20
|
def slip
|
17
21
|
load_order
|
18
22
|
@slip = true
|
19
|
-
@template = "
|
20
|
-
render
|
23
|
+
@template = "invoice"
|
24
|
+
render @template
|
21
25
|
end
|
22
26
|
|
27
|
+
# reminder is an invoice with an extra text to kindly pay up
|
23
28
|
def reminder
|
24
29
|
load_order
|
25
30
|
@reminder = true
|
26
|
-
@template = "
|
27
|
-
render
|
31
|
+
@template = "invoice"
|
32
|
+
render @template
|
28
33
|
end
|
29
34
|
|
30
35
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# coding: UTF-8
|
2
|
+
require 'barby'
|
3
|
+
require 'prawn'
|
4
|
+
require 'prawn/measurement_extensions'
|
5
|
+
require 'barby/barcode/code_128'
|
6
|
+
require 'barby/barcode/ean_13'
|
7
|
+
require 'barby/outputter/png_outputter'
|
8
|
+
|
9
|
+
ProductsController.class_eval do
|
10
|
+
# loads of ways to create barcodes nowadays, this is a bit older.
|
11
|
+
# Used to be html but moved to pdf for better layout control
|
12
|
+
def barcode
|
13
|
+
load_product
|
14
|
+
code = @product.ean
|
15
|
+
code = @product.name if code.blank?
|
16
|
+
if code.length == 12
|
17
|
+
aBarcode = ::Barby::EAN13.new( code )
|
18
|
+
else
|
19
|
+
aBarcode = ::Barby::Code128B.new( code )
|
20
|
+
end
|
21
|
+
pdf = create_pdf
|
22
|
+
pdf.image( StringIO.new( aBarcode.to_png(:xdim => 5)) , :width => 50.mm ,
|
23
|
+
:height => 10.mm , :at => [ 0 , 10.mm])
|
24
|
+
send_data pdf.render , :type => "application/pdf" , :filename => "#{@product.full_name}.pdf"
|
25
|
+
end
|
26
|
+
|
27
|
+
def barcode_button
|
28
|
+
load_product
|
29
|
+
if @product.line?
|
30
|
+
render :nothing => true
|
31
|
+
else
|
32
|
+
render :layout => false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
private
|
36
|
+
|
37
|
+
def create_pdf
|
38
|
+
pdf = Prawn::Document.new( :page_size => [ 54.mm , 25.mm ] , :margin => 2.mm )
|
39
|
+
pdf.text( @product.full_name , :align => :left )
|
40
|
+
pdf.text( "#{@product.price} € " , :align => :right , :padding => 5.mm)
|
41
|
+
pdf
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= link_to t(:print_order), receipt_order_path(@basket.kori) , :target => "_blank" , :class => "btn btn-primary print_order" if @basket.isa(:order)
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
1
|
+
.row.address
|
2
|
+
- addresses = [ @order.name , @order.street, @order.city , @order.phone ]
|
2
3
|
|
3
|
-
%table
|
4
|
-
%tr
|
5
|
-
%td.billing_header.bold{:width => "45%"}= I18n.t(:address)
|
6
|
-
%td{:width => "17%"}
|
7
|
-
%td.shiping_header.bold{:width => "45%"}
|
8
|
-
- addresses.each do |row|
|
4
|
+
%table
|
9
5
|
%tr
|
10
|
-
%td.cell{:height => "15px", :width => "45%"}
|
11
|
-
= row
|
12
6
|
%td{:width => "17%"}
|
13
|
-
%td.
|
14
|
-
|
7
|
+
%td.shipping_header.bold{:width => "45%"}
|
8
|
+
- addresses.each do |row|
|
9
|
+
%tr
|
10
|
+
%td.cell{:height => "15px", :width => "45%"}
|
11
|
+
= row
|
12
|
+
%td{:width => "17%"}
|
13
|
+
%td.cell{:height => "15px", :width => "45%"}
|
14
|
+
= " "
|
@@ -1,7 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%
|
4
|
-
%
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
.row.footer
|
2
|
+
.col-xs-4
|
3
|
+
%b= raw I18n.t(:footer_left)
|
4
|
+
%br
|
5
|
+
= raw I18n.t(:footer_left2)
|
6
|
+
|
7
|
+
.col-xs-4
|
8
|
+
= raw I18n.t(:footer_center)
|
9
|
+
|
10
|
+
.col-xs-4
|
11
|
+
= raw I18n.t(:footer_right)
|
12
|
+
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
.row.header
|
2
|
+
.col-xs-6
|
3
|
+
= image_tag "kauppa/invoice-logo.gif", :id => "logo"
|
4
|
+
.sender
|
5
|
+
= raw I18n.t(:kauppa_osoite)
|
6
|
+
%br
|
7
|
+
.col-xs-6.text-right
|
8
|
+
%p.title= I18n.t("#{@template}.header")
|
9
|
+
%b= I18n.t(:order_number).to_s + " " + @order.number
|
10
|
+
/
|
11
|
+
= I18n.l(@order.ordered_on.to_date) if @order.ordered_on
|
@@ -1,17 +1,11 @@
|
|
1
1
|
%table.items
|
2
|
-
%colgroup
|
3
|
-
%col/
|
4
|
-
%col/
|
5
|
-
%col.price/
|
6
|
-
%col.qty/
|
7
|
-
%col.total/
|
8
2
|
%tr
|
9
3
|
%td.sku.bold= t(:ean) unless @receipt
|
10
4
|
%td.desc.bold= t(:description)
|
11
|
-
%td.price.bold= t(:price) unless @receipt
|
12
|
-
%td.qty.bold
|
5
|
+
%td.price.bold.text-right= t(:price) unless @receipt
|
6
|
+
%td.qty.bold.text-right
|
13
7
|
= t(:qty)
|
14
|
-
%td.total.bold= t(:total)
|
8
|
+
%td.total.bold.text-right= t(:total)
|
15
9
|
- @order.basket.items.each do |item|
|
16
10
|
%tr
|
17
11
|
%td.cell= item.product.ean unless @receipt
|
@@ -19,6 +13,6 @@
|
|
19
13
|
= item.product.fullname rescue item.product.name
|
20
14
|
- if item.discount > 0
|
21
15
|
(#{-item.discount}%)
|
22
|
-
%td.cell.price= number_to_currency(item.price) unless @receipt
|
23
|
-
%td.cell.qty= item.quantity
|
24
|
-
%td.cell.total= number_to_currency(item.price * item.quantity)
|
16
|
+
%td.cell.price.text-right= number_to_currency(item.price) unless @receipt
|
17
|
+
%td.cell.qty.text-right= item.quantity
|
18
|
+
%td.cell.total.text-right= number_to_currency(item.price * item.quantity)
|
@@ -1,18 +1,7 @@
|
|
1
1
|
- base = @order.number[1 .. -1]
|
2
2
|
- viite = open("http://www1.nordea.fi/P636V/H636VTXT.asp?action=tekstiLista&lkm=1&alkuViite=#{base}&L=1").read[/\d+ \d+/]
|
3
3
|
- unless @slip
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
%tr
|
9
|
-
%td{:colspan => "2"}
|
10
|
-
Maksaessasi käytä viitenumeroa: #{viite}
|
11
|
-
%table.thanks_table
|
12
|
-
%tr
|
13
|
-
%td.cell{:cellspan => "2"}
|
14
|
-
%td.cell
|
15
|
-
%tr
|
16
|
-
%td.thanks.cell{:cellspan => "2"}
|
17
|
-
= raw t("#{@template}.thanks" )
|
18
|
-
%td.cell
|
4
|
+
Maksaessasi käytä viitenumeroa: #{viite}
|
5
|
+
%br
|
6
|
+
%b
|
7
|
+
= raw t("#{@template}.thanks" )
|
@@ -1,23 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
= render :partial => "orders/invoice_totals" unless @slip
|
22
|
-
.footer
|
23
|
-
= render :partial => "orders/invoice_footer"
|
1
|
+
.invoice
|
2
|
+
= render :partial => "orders/invoice_header"
|
3
|
+
|
4
|
+
|
5
|
+
= render :partial => "orders/invoice_address"
|
6
|
+
|
7
|
+
|
8
|
+
.row.wrapper
|
9
|
+
.items
|
10
|
+
= render :partial => "orders/#{@template}_items"
|
11
|
+
.spacer
|
12
|
+
\
|
13
|
+
.row
|
14
|
+
.totals
|
15
|
+
= render :partial => "orders/invoice_totals" unless @slip
|
16
|
+
.thanks
|
17
|
+
= render :partial => "orders/invoice_thanks"
|
18
|
+
|
19
|
+
= render :partial => "orders/invoice_footer"
|
20
|
+
|
@@ -1,52 +1,45 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
=
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
%
|
22
|
-
%
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
%
|
44
|
-
|
45
|
-
|
46
|
-
-@order.taxes.each do |tax_rate , amount|
|
47
|
-
%tr.total
|
48
|
-
%td.cel1.bold
|
49
|
-
= t(:vat) + " " + tax_rate.to_s + " % "
|
50
|
-
%td.cel2.cell{align: "right"}= euros amount
|
51
|
-
.footer
|
52
|
-
= render :partial => "orders/receipt_footer"
|
1
|
+
.receipt
|
2
|
+
#receipt-header
|
3
|
+
= render :partial => "orders/receipt_header"
|
4
|
+
.receipt-info
|
5
|
+
- date = @order.ordered_on || @order.ordered_on
|
6
|
+
=l(date.to_date)
|
7
|
+
/
|
8
|
+
=t(:order)
|
9
|
+
=@order.number
|
10
|
+
%br/
|
11
|
+
.receipt-wrapper
|
12
|
+
.receipt-line_items
|
13
|
+
%table.receipt-line_items
|
14
|
+
%thead
|
15
|
+
%tr
|
16
|
+
%th Tuote
|
17
|
+
%th Määrä
|
18
|
+
%th Loppusumma
|
19
|
+
%tbody
|
20
|
+
- @order.basket.items.each do |i|
|
21
|
+
%tr
|
22
|
+
%td.receipt-cell= i.product.full_name
|
23
|
+
%td.receipt-cell.receipt-qty= i.quantity
|
24
|
+
%td.receipt-cell.receipt-total= euros i.total
|
25
|
+
.spacer
|
26
|
+
|
27
|
+
.receipt-totals
|
28
|
+
%table.receipt-totals
|
29
|
+
%tbody
|
30
|
+
%tr
|
31
|
+
%td.receipt-cel1.bold
|
32
|
+
%strong= t(:order_total)
|
33
|
+
%td.receipt-cel2.cell{align: "right"}
|
34
|
+
%strong
|
35
|
+
%span#receipt-summary-order-total= euros @order.total_price
|
36
|
+
%tr
|
37
|
+
%td.receipt-cel1
|
38
|
+
%td.receipt-cel2
|
39
|
+
-@order.taxes.each do |tax_rate , amount|
|
40
|
+
%tr.receipt-total
|
41
|
+
%td.receipt-cel1.bold
|
42
|
+
= t(:vat) + " " + tax_rate.to_s + " % "
|
43
|
+
%td.receipt-cel2.receipt-cell{align: "right"}= euros amount
|
44
|
+
.receipt-footer
|
45
|
+
= render :partial => "orders/receipt_footer"
|
data/config/routes.rb
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
OfficeClerk::Engine.routes.append do
|
2
2
|
resources :orders do
|
3
3
|
member do
|
4
|
+
get :button_list
|
4
5
|
get :invoice
|
5
6
|
get :receipt
|
6
7
|
get :slip
|
7
8
|
get :reminder
|
8
9
|
end
|
9
10
|
end
|
11
|
+
resources :baskets do
|
12
|
+
member do
|
13
|
+
get :button_list
|
14
|
+
end
|
15
|
+
end
|
16
|
+
resources :products do
|
17
|
+
member do
|
18
|
+
get :barcode #print the barcode and price on a 50x25 mm area
|
19
|
+
get :barcode_button
|
20
|
+
end
|
21
|
+
end
|
10
22
|
end
|
data/lib/print_clerk.rb
CHANGED
@@ -2,23 +2,28 @@ module PrintClerk
|
|
2
2
|
class Engine < Rails::Engine
|
3
3
|
engine_name 'print_clerk'
|
4
4
|
|
5
|
+
# indicate that we have stylesheet/js stuff to be added to office, with the given name
|
6
|
+
# files (css + js) must exist in asset path
|
7
|
+
def office_assets
|
8
|
+
"print_office"
|
9
|
+
end
|
10
|
+
|
5
11
|
config.autoload_paths += %W(#{config.root}/lib)
|
6
12
|
|
7
13
|
initializer "print_invoice.assets.precompile", :after => "clerk.assets.precompile" do |app|
|
8
|
-
app.config.assets.precompile += [
|
14
|
+
app.config.assets.precompile += [ "print_office.js" , "print_office.css"]
|
9
15
|
end
|
10
16
|
|
11
17
|
def self.activate
|
12
18
|
Dir.glob(File.join(File.dirname(__FILE__), '../app/**/*_decorator.rb')) do |c|
|
13
19
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
14
20
|
end
|
15
|
-
|
16
|
-
Dir.glob(File.join(File.dirname(__FILE__), '../app/overrides/*.rb')) do |c|
|
17
|
-
Rails.configuration.cache_classes ? require(c) : load(c)
|
18
|
-
end
|
19
21
|
end
|
20
22
|
|
21
23
|
config.to_prepare &method(:activate).to_proc
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
27
|
+
require "prawn"
|
28
|
+
require "barby"
|
29
|
+
require "chunky_png"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: print_clerk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Torsten Ruger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: office_clerk
|
@@ -16,16 +16,61 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
27
|
-
|
28
|
-
|
26
|
+
version: '0.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: barby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.6'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: chunky_png
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: prawn
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.2'
|
69
|
+
description: Html based, ie client side, printing for orders. Different styles are
|
70
|
+
invoice, packing slip and receipt (for receipt printer in shop). Easy to configure
|
71
|
+
and adapt
|
72
|
+
email:
|
73
|
+
- torsten@villataika.fi
|
29
74
|
executables: []
|
30
75
|
extensions: []
|
31
76
|
extra_rdoc_files: []
|
@@ -33,10 +78,14 @@ files:
|
|
33
78
|
- README.md
|
34
79
|
- app/assets/images/invoice_logo.jpg
|
35
80
|
- app/assets/images/receipt-logo.gif
|
36
|
-
- app/assets/
|
37
|
-
- app/assets/stylesheets/
|
81
|
+
- app/assets/javascripts/print_office.js.coffee
|
82
|
+
- app/assets/stylesheets/print_office.css
|
83
|
+
- app/controllers/baskets_controller_decorator.rb
|
38
84
|
- app/controllers/orders_decorator.rb
|
85
|
+
- app/controllers/product_controller_decorator.rb
|
86
|
+
- app/helpers/orders_helper_decorator.rb
|
39
87
|
- app/overrides/add_html_invoice_buttons.rb
|
88
|
+
- app/views/baskets/button_list.haml
|
40
89
|
- app/views/orders/_html_buttons.haml
|
41
90
|
- app/views/orders/_invoice_address.haml
|
42
91
|
- app/views/orders/_invoice_footer.haml
|
@@ -48,12 +97,15 @@ files:
|
|
48
97
|
- app/views/orders/_receipt_header.haml
|
49
98
|
- app/views/orders/_reminder_items.haml
|
50
99
|
- app/views/orders/_slip_items.haml
|
100
|
+
- app/views/orders/button_list.haml
|
51
101
|
- app/views/orders/invoice.haml
|
52
102
|
- app/views/orders/receipt.haml
|
103
|
+
- app/views/products/barcode_button.haml
|
53
104
|
- config/routes.rb
|
54
105
|
- lib/print_clerk.rb
|
55
|
-
homepage:
|
56
|
-
licenses:
|
106
|
+
homepage: https://github.com/rubyclerks/print_clerk
|
107
|
+
licenses:
|
108
|
+
- MIT
|
57
109
|
metadata: {}
|
58
110
|
post_install_message:
|
59
111
|
rdoc_options: []
|
@@ -75,5 +127,5 @@ rubyforge_project:
|
|
75
127
|
rubygems_version: 2.2.2
|
76
128
|
signing_key:
|
77
129
|
specification_version: 4
|
78
|
-
summary: Print invoices
|
130
|
+
summary: Print invoices for a rubyclerk order
|
79
131
|
test_files: []
|
@@ -1,140 +0,0 @@
|
|
1
|
-
div.a4 {
|
2
|
-
width: 620px;
|
3
|
-
font-size: 12px;
|
4
|
-
font-family: helvetica, verdana, serif;
|
5
|
-
|
6
|
-
}
|
7
|
-
|
8
|
-
img#logo {
|
9
|
-
width: 280px;
|
10
|
-
padding-bottom: 12px;
|
11
|
-
}
|
12
|
-
|
13
|
-
div.header {
|
14
|
-
width: 620px;
|
15
|
-
height: 100px;
|
16
|
-
}
|
17
|
-
|
18
|
-
div.address {
|
19
|
-
width: 620px;
|
20
|
-
border-top:1px solid grey;
|
21
|
-
margin-bottom: 10px;
|
22
|
-
padding: 6px;
|
23
|
-
|
24
|
-
}
|
25
|
-
.items {
|
26
|
-
width: 620px;
|
27
|
-
}
|
28
|
-
|
29
|
-
.items .price, .items .total {
|
30
|
-
text-align: right;
|
31
|
-
}
|
32
|
-
|
33
|
-
.items .qty {
|
34
|
-
text-align: center;
|
35
|
-
}
|
36
|
-
|
37
|
-
div.wrapper {
|
38
|
-
width: 620px;
|
39
|
-
height: 540px;
|
40
|
-
border-top:1px solid grey;
|
41
|
-
padding: 6px;
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
div.thanks {
|
46
|
-
width: 620px;
|
47
|
-
margin-top: 20px;
|
48
|
-
margin-bottom: 20px;
|
49
|
-
line-height: 10px;
|
50
|
-
}
|
51
|
-
div.spacer {
|
52
|
-
width: 620px;
|
53
|
-
}
|
54
|
-
div.totals {
|
55
|
-
height: 100px;
|
56
|
-
margin-bottom: 20px;
|
57
|
-
float: right;
|
58
|
-
}
|
59
|
-
|
60
|
-
.totals .cell {
|
61
|
-
width: 130px;
|
62
|
-
}
|
63
|
-
|
64
|
-
div.footer {
|
65
|
-
width: 620px;
|
66
|
-
border-top:1px solid grey;
|
67
|
-
padding: 6px;
|
68
|
-
}
|
69
|
-
|
70
|
-
.footer .bold {
|
71
|
-
width: 100px;
|
72
|
-
}
|
73
|
-
.footer .cell {
|
74
|
-
width: 220px;
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
.title { font-weight: bold; color: #FF9933; font-size: 18px; }
|
79
|
-
.bold { font-weight: bold; }
|
80
|
-
.price { width: 80px ; }
|
81
|
-
|
82
|
-
table.address{
|
83
|
-
width: 620px;
|
84
|
-
}
|
85
|
-
table.index th {
|
86
|
-
background: #cdcdcd top left repeat-x;
|
87
|
-
padding: 7px 10px;
|
88
|
-
border-left: 1px solid #ddd;
|
89
|
-
border-top: 1px solid #ddd;
|
90
|
-
border-right: 1px solid #aaa;
|
91
|
-
border-bottom: 1px solid #aaa;
|
92
|
-
text-shadow: #efefef 1px 1px 0px; }
|
93
|
-
table.index th .right {
|
94
|
-
float:right;
|
95
|
-
font-weight:normal;
|
96
|
-
}
|
97
|
-
table.index th.id-col {
|
98
|
-
text-align: center; }
|
99
|
-
table.index td {
|
100
|
-
border-bottom:1px solid #ddd;
|
101
|
-
padding: 3px 10px;
|
102
|
-
}
|
103
|
-
table.index td.lbl-col {
|
104
|
-
width: 12%; }
|
105
|
-
table.index td.val-col {
|
106
|
-
width: 38%; }
|
107
|
-
table.index tr.alt td {
|
108
|
-
background-color: #efefef; }
|
109
|
-
table.index.green th {
|
110
|
-
background: #cfefa7 top left repeat-x;
|
111
|
-
border-left: 1px solid #E4FDB4;
|
112
|
-
border-top: 1px solid #E4FDB4;
|
113
|
-
border-right: 1px solid #B7CB90;
|
114
|
-
border-bottom: 1px solid #B7CB90; }
|
115
|
-
table.index.green td {
|
116
|
-
background-color: #efe; }
|
117
|
-
table.index.order-summary {
|
118
|
-
clear: both; }
|
119
|
-
table.index.order-summary tr.totals th {
|
120
|
-
background: transparent;
|
121
|
-
text-align: right;
|
122
|
-
border: none; }
|
123
|
-
table.index td.actions {text-align:right;}
|
124
|
-
|
125
|
-
table.footer td{
|
126
|
-
line-height: 16px;
|
127
|
-
padding-bottom: 3px;
|
128
|
-
}
|
129
|
-
|
130
|
-
|
131
|
-
div.cod {
|
132
|
-
float: left;
|
133
|
-
background: black;
|
134
|
-
color: white;
|
135
|
-
font-size: 16px;
|
136
|
-
padding: 5px;
|
137
|
-
font-weight: bold;
|
138
|
-
}
|
139
|
-
|
140
|
-
|
@@ -1,77 +0,0 @@
|
|
1
|
-
@page {
|
2
|
-
margin-left:8mm;
|
3
|
-
margin-right:8mm;
|
4
|
-
margin-top:8mm;
|
5
|
-
margin-bottom:8mm;
|
6
|
-
}
|
7
|
-
|
8
|
-
body {
|
9
|
-
font-family:"Trebuchet MS";
|
10
|
-
font-size:32px;
|
11
|
-
color:#000000;
|
12
|
-
width: 700px;
|
13
|
-
}
|
14
|
-
|
15
|
-
|
16
|
-
div#header {
|
17
|
-
text-align: center;
|
18
|
-
padding: 6px;
|
19
|
-
line-height: 1.3;
|
20
|
-
width: 700px;
|
21
|
-
}
|
22
|
-
|
23
|
-
#header img {
|
24
|
-
max-width: 670px;
|
25
|
-
}
|
26
|
-
|
27
|
-
.shop { font-weight: bold; font-size: 40px; line-height: 1.2;}
|
28
|
-
.info { padding: 6px; font-size: 30px; text-align: center; line-height: 1.3; width: 700px;}
|
29
|
-
|
30
|
-
.line_items {
|
31
|
-
width: 700px;
|
32
|
-
}
|
33
|
-
|
34
|
-
div.wrapper {
|
35
|
-
width: 700px;
|
36
|
-
padding-top: 48px;
|
37
|
-
text-align: left;
|
38
|
-
}
|
39
|
-
|
40
|
-
div.totals {
|
41
|
-
margin-bottom: 20px;
|
42
|
-
padding: 6px;
|
43
|
-
}
|
44
|
-
|
45
|
-
table.totals {
|
46
|
-
width: 700px;
|
47
|
-
}
|
48
|
-
|
49
|
-
|
50
|
-
.cell.total {
|
51
|
-
text-align: right;
|
52
|
-
}
|
53
|
-
|
54
|
-
.cel1 {
|
55
|
-
width: 200px;
|
56
|
-
}
|
57
|
-
|
58
|
-
.cel2 {
|
59
|
-
width: 80px;
|
60
|
-
}
|
61
|
-
|
62
|
-
|
63
|
-
div.footer {
|
64
|
-
width: 700px;
|
65
|
-
padding: 6px;
|
66
|
-
text-align: center;
|
67
|
-
}
|
68
|
-
|
69
|
-
.footer .bold {
|
70
|
-
width: 100px;
|
71
|
-
}
|
72
|
-
.footer .cell {
|
73
|
-
width: 220px;
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
|