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

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

1.1       andrew      1: #!/usr/bin/perl
1.3     ! andrew      2: # $AFresh1: test.pl,v 1.2 2011/03/20 01:34:42 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:                 {
1.3     ! andrew     64:                     contents => 'Rounding FAIL',
        !            65:                     detail => 'Should be $8.30',
        !            66:                     count => .083,
        !            67:                     rate => 100,
1.1       andrew     68:                 },
                     69:             ],
                     70:         },
                     71:         {
                     72:             id => 65,
                     73:             title => '65: More work!',
1.2       andrew     74:             detail => 'Requestors jdoe@example.net',
1.1       andrew     75:             fees => [
                     76:                 {
                     77:                     contents => '2011-01-06: Define Project (751)',
                     78:                     count => 0.33,
                     79:                     rate => 75,
                     80:                 },
                     81:                 {
                     82:                     contents => '2011-01-11: Code it up! (823)',
                     83:                     count => 5,
                     84:                     rate => 100,
                     85:                 },
                     86:                 {
                     87:                     contents => '2011-01-12: REdefine Project (903)',
                     88:                     count => 0.25,
                     89:                     rate => 75,
                     90:                 },
                     91:                 {
                     92:                     contents => '2011-01-13: Change everything: 933',
                     93:                     count => 3,
                     94:                     rate => 125,
                     95:                 },
                     96:             ],
                     97:         },
                     98:         {
                     99:             id => 85,
                    100:             title => '85: Replace stuff',
1.2       andrew    101:             detail => 'Requestors maintenance@example.net',
1.1       andrew    102:             fees => [
                    103:                 {
                    104:                     contents => '2011-01-13: Go unplug, replace, replug (834)',
                    105:                     count => 2,
                    106:                     rate => 125,
                    107:                 },
                    108:             ],
                    109:             expenses => [
                    110:                 {
                    111:                     contents => '2x unbroken thingys',
                    112:                     amount  => 25,
                    113:                 }
                    114:             ],
                    115:         },
                    116:         {
                    117:             id => 90,
                    118:             title => '90: Make a two page invoice',
                    119:             fees => [
                    120:                 {
                    121:                     contents => '2011-01-13: Add some stuff (834)',
                    122:                     count => 2,
                    123:                     rate => 125,
                    124:                 },
                    125:             ],
                    126:         },
                    127:     ],
1.3     ! andrew    128:     discount => {
        !           129:         contents => 'Discount',
        !           130:         amount   => '8.498',
        !           131:     },
1.1       andrew    132: );
                    133:
                    134: my $tt = Template->new;
                    135:
                    136: $tt->process( 'invoice.tex.tt', \%invoice, 'invoice.pdf' ) || die $tt->error . "\n";

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