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