24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/billing.rb', line 24
def printout debugger
return if @sales.empty?
p = Person.find(:first, :conditions => ['username=?', debugger])
return unless p
debugger = p.firstname + " " + p.lastname
date = dutch_date
def to_groff (str)
gr = ''
str.unpack('U*').each do |c|
gr += c < 256 ? c.chr : sprintf('\[u%04X]', c)
end
return gr
end
groff = IO.popen(CONFIG["groff"], "w")
groff.print <<EOF
.TS
box, expand ;
l r
^ r .
T{
Infogroep
p/a Faculteit Wetenschappen
lokaal 1E8, tel. 02/629 33 56
Vrije Universiteit Brussel
T}\tBrussel, #{date}
\tT{
.PS
B: box height 1 width 3.3
.ps 8
" stempel" at B.sw above ljust
.ps 10
.PE
T}
.TE
.TS
box, expand ;
l | c | c
l | n | n .
Omschrijving artikels\tAantal\tPrijs
_
EOF
each do |s|
groff.printf("%s\t%d\t%.2f\n", to_groff(s.product.name), s.count, s.price)
end
groff.print <<EOF
_
.T&
l s nB .
T{
Voor Infogroep,
#{to_groff(debugger)}
T}\t#{sprintf '%.2f', total_price}
.TE
EOF
groff.close
end
|