NAME

WebService::NetSuite::SuiteTalk::Role::AccountingPeriod - Role providing NetSuite accounting periods

VERSION

version 0.003

SYNOPSIS

use Moo;
use Scalar::Util 'blessed';
with 'WebService::NetSuite::SuiteTalk::Role::AccountingPeriod';

has connection => (
    is       => 'ro',
    isa      => sub {
        die unless blessed $_[0]
            and $_[0]->isa('WebService::NetSuite::SuiteTalk');
    },
);

sub periods {
    my $self = shift;

    my @accounting_periods = $self->accounting_periods;
    my $first_period       = $self->get_accounting_period(1);

    my $period_record = $first_period->{record};
    my $period_span   = $first_period->{span};

    return;
}

DESCRIPTION

This is a role for discovering the accounting periods available in a NetSuite account. It's meant to be applied to classes that use WebService::NetSuite::SuiteTalk.

Any error received when retrieving the list of accounting periods will throw an exception.

METHODS

accounting_periods

Returns a reference to a hash where each key is the internal ID of a NetSuite accounting period and its value is a hash reference with two keys:

record

A hash reference containing the fields for the specific accounting period.

span

A DateTime::Span object for the accounting period.

accounting_period_trees

Returns a list of the accounting periods for the current NetSuite connection. Each element is an instance of a Tree::DAG_Node whose individual nodes describe the nested relationship between accounting periods.

get_accounting_period

Given an internal ID of a NetSuite accounting period, this will return a hash reference with the two keys mentioned above under accounting_periods.

date_posting_period_ref

Given a DateTime object, this will return a hash reference to a NetSuite platformCore:RecordRef of type accountingPeriod for the currently connected NetSuite account.

posting_period_parameter

Given a DateTime object, this will return a two-item list (i.e., a key-value pair) with the first itme being postingPeriod and the second item the results of a date_posting_period_ref call on that DateTime.

REQUIRED METHODS

connection

This must be a method that returns a WebService::NetSuite::SuiteTalk object.

SUPPORT

Perldoc

You can find documentation for this module with the perldoc command.

perldoc WebService::NetSuite::SuiteTalk

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Bugs / Feature Requests

Please report any bugs or feature requests through the web interface at https://github.com/mjgardner/webservice-netsuite-suitetalk/issues. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/mjgardner/webservice-netsuite-suitetalk

git clone git://github.com/mjgardner/webservice-netsuite-suitetalk.git

AUTHOR

Mark Gardner <mjgardner@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by ZipRecruiter.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.