[BACK]Return to test.pl CVS log [TXT][DIR] Up to [local] / RT / Invoicing

Annotation of RT/Invoicing/test.pl, Revision 1.5

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>