Annotation of RT/Invoicing/test.pl, Revision 1.2
1.1 andrew 1: #!/usr/bin/perl
1.2 ! andrew 2: # $AFresh1: test.pl,v 1.1.1.1 2011/03/19 22:27:16 andrew Exp $
1.1 andrew 3: use strict;
4: use warnings;
5:
6: use Template;
7:
8: my %invoice = (
9: id => 1,
10: info1 => 'Visit me online at http://example.com',
11: info2 => 'Create a new ticket rt@example.com',
12: from => {
13: name => 'Example Company',
14: #attn => 'Jane Smith',
15: addr1 => '22115 Central Way',
16: addr2 => 'Suite C',
17: city => 'Anytown',
18: state => 'America',
19: zip => '11111',
20: phone => '(800) 555-1212',
21: email => 'company@example.com',
22: },
23: to => {
24: name => 'John Doe',
25: addr1 => '123 W Main St',
26: city => 'Anytown',
27: state => 'America',
28: zip => '11111',
29: },
30: projects => [
31: {
32: title => 'Weekly Retainer',
33: fees => [
34: {
35: contents => '2011-03-06 through 2011-03-12',
36: count => 1,
37: rate => 300,
38: },
39: {
40: contents => '2011-03-13 through 2011-03-19',
41: count => 1,
42: rate => 300,
43: },
44: ],
45: },
46: {
47: id => 60,
48: title => '60: A Special Project',
1.2 ! andrew 49: detail => 'Requestors jdoe@example.net',
1.1 andrew 50: fees => [
51: {
52: contents => '2011-01-01: Talk a lot (727)',
1.2 ! andrew 53: detail => 'This is detail about 727',
1.1 andrew 54: count => 0.33,
55: rate => 75,
56: },
57: {
58: contents => '2011-01-15: Write Stuff (730)',
1.2 ! andrew 59: detail => 'This is detail about 730',
1.1 andrew 60: count => 1.5,
61: rate => 100,
62: },
63: ],
64: discounts => [
65: {
66: contents => 'Included Hours',
67: amount => .33 * 75,
68: },
69: {
70: contents => 'Included Hours',
71: amount => 1.5 * 100,
72: },
73: ],
74: },
75: {
76: id => 65,
77: title => '65: More work!',
1.2 ! andrew 78: detail => 'Requestors jdoe@example.net',
1.1 andrew 79: fees => [
80: {
81: contents => '2011-01-06: Define Project (751)',
82: count => 0.33,
83: rate => 75,
84: },
85: {
86: contents => '2011-01-11: Code it up! (823)',
87: count => 5,
88: rate => 100,
89: },
90: {
91: contents => '2011-01-12: REdefine Project (903)',
92: count => 0.25,
93: rate => 75,
94: },
95: {
96: contents => '2011-01-13: Change everything: 933',
97: count => 3,
98: rate => 125,
99: },
100: ],
101: discounts => [
102: {
103: contents => 'Included Hours',
104: amount => (.33 * 75) + ( 3.33 * 100 ),
105: },
106: {
107: contents => 'Included Hours',
108: amount => (.25 * 75 ) + (2.25 * 100),
109: },
110: ],
111: },
112: {
113: id => 85,
114: title => '85: Replace stuff',
1.2 ! andrew 115: detail => 'Requestors maintenance@example.net',
1.1 andrew 116: fees => [
117: {
118: contents => '2011-01-13: Go unplug, replace, replug (834)',
119: count => 2,
120: rate => 125,
121: },
122: ],
123: expenses => [
124: {
125: contents => '2x unbroken thingys',
126: amount => 25,
127: }
128: ],
129: },
130: {
131: id => 90,
132: title => '90: Make a two page invoice',
133: fees => [
134: {
135: contents => '2011-01-13: Add some stuff (834)',
136: count => 2,
137: rate => 125,
138: },
139: ],
140: },
141: ],
142: );
143:
144: my $tt = Template->new;
145:
146: $tt->process( 'invoice.tex.tt', \%invoice, 'invoice.pdf' ) || die $tt->error . "\n";
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>