NAME
    Business::Price - Handles prices with tax and discount

VERSION
    version 1.000_1

SYNOPSIS
     use Business::Price;
     my $price = Business::Price->new( value => 10, tax => 0.1, discount => 0.5 );
     is( $price->full, 11 );
     is( $price->full->discounted, 5.5 );

ATTRIBUTES
  value ( Num )
    Required

    The object stringifies to this attribute.

  discount ( Num | ArrayRef | HashRef | CodeRef )
    Default: 0

  tax ( Num )
    Default: 0

    Defines the tax rate. Valid values are from 0 to 1 (excluded).

  incl ( Bool )
    Default: 0

    Specifies whether value includes tax or not.

METHODS
    Methods will always return a new Business::Price object. It stringifies
    to value and you can do math on those object since it uses overload.

      my $price = Business::Price->new( value => 10 ); 
      ok( $price->isa('Business::Price') );
      is( $price, 10 );
      is( $price / 2, 5 );

  net
    Returns an object with the net price applied (i.e. without tax).

     my $price = Business::Price->new( value => 1.1, tax => 0.1, incl => 1); 
     is( $price->net, 1 );

  full
    Returns an object with the full price applied (i.e. tax applied).

     my $price = Business::Price->new( value => 1, tax => 0.1 ); 
     is( $price->full, 1.1 );

  discounted ( Any )
    Discount the price by the format defined in discount.

     my $price = Business::Price->new( value => 1, discount => 0.5 );
     is( $price->discounted, 0.5 );
     is( $price->discounted->discounted, 0.25 );


     my $price = Business::Price->new(
         value    => 1,
         discount => sub {
             my ( $self, $is_reseller ) = @_;
             return $is_reseller ? $self / 2 : $self;
         }
     );
     is( $price->discounted(0), 1 );
     is( $price->discounted(1), 0.5 );

  clone ( Hash )
    Clone the object. Any parameters overwrite the object's attributes.

      my $price_excl = Business::Price->new( value => 1, incl => 0 );
      my $price_incl = $price->clone( incl => 1 );

SEE ALSO
    Business::Tax::Canada, Business::Tax::VAT, Moose

AUTHOR
      Moritz Onken <onken@netcubed.de>

COPYRIGHT AND LICENSE
    This software is Copyright (c) 2010 by Moritz Onken.

    This is free software, licensed under:

      The (three-clause) BSD License

