Finance::Bank::DE::DTA::Create(3p)

NAME
Finance::Bank::DE::DTA::Create - Creating DTA/DTAUS files for use in Banking Software or for sending to the bank. Works for inner German money transactions only (receiver and sender must have german bank accounts)

IMPORTANT NOTE
ALWAYS doublecheck the items, after importing the DTA file into your banking software prior to sending the order to your bank! You can also check your DTA-file here: https://www.xpecto.de/index.php?id=148,7

SYNOPSIS
        use Finance::Bank::DE::DTA::Create;
        my $dta = new Finance::Bank::DE::DTA::Create({
                type           => 'credit', #or debit, for 'Lastschrifteinzug'
                name           => $sendername,
                bank_code      => $senderbankcode,
                account_number => $senderaccount,
        });

        # add an item to the list
        $dta->addExchange(
                {
                        name           => "John Doe",
                        bank_code      => "12345678",
                        account_number => "1234567890",
                },
                100.45,
                [ "$purpose1", "$purpose2" ]
        );

        # add another item to the list
        $dta->addExchange(
                {
                        name           => "Jane Doe",
                        bank_code      => "87654321",
                        account_number => "0987654321",
                },
                99.75,
                $purpose3
        );

        # save the dta file
        open(DAT, ">dta.txt") || die "$!";
        print DAT $dta->getContent();
        close DAT;

SUBROUTINES / METHODS

  new()
The constructor. The parameters type, name, bank_code and account_number are all mandatory. If not set properly the module will return 0.

•   type - this parameter indicates whether you want to create a dta file with credits (you send money) or with debits (you collect money). Possible values: credit or debit.

•   name - in the new()-Method this represents the name of the account owner where the dta-file will be used (i.e. this is you).

•   bank_code - in the new()-Method this represents the routing number (BLZ) of the account where the dta-fill will be used.

•   account_number - in the new()-Method this represents the number of the account where the dta-fill will be used.

        my $dta = new Finance::Bank::DE::DTA::Create({
                type           => 'credit', #or debit, for 'Lastschrifteinzug' (collecting money)
                name           => $sendername,
                bank_code      => $senderbankcode,
                account_number => $senderaccount,
        });

  addExchange()
With addExchange() you add an item to the list of transactions.

The first parameter to this method is a hash with the information of the account you are sending money to (or collect money from). This hash has the mandatory keys name, bank_code (BLZ) and account_number. If they are not set properly function returns 0.

The second parameter is the amount you are sending or collecting. If amount is not > 0 function returns 0.

The third parameter is for the purpose of the transaction. It may either be a string for just one purpose (one line), or an array with two purpose strings (two lines).

        $dta->addExchange(
                {
                        name           => "John Doe",
                        bank_code      => "12345678",
                        account_number => "1234567890",
                },
                100.45,
                [ "$purpose1", "$purpose2" ] #or just $purpose
        );

  amount()
With amount() you can retrieve the total amount of all transactions, you already added.

  items()
With items() you can retrieve the total number of transactions, you already added.

  sum_accounts()
With sum_accounts() you can retrieve the sum of account numbers. Use for control purposes.

  sum_bank_codes()
With sum_bank_codes() you can retrieve the sum of bank_codes (BLZs). Use for control purposes.

        $dta->addExchange(
                {
                        name           => "Jane Doe",
                        bank_code      => "87654321",
                        account_number => "0987654321",
                },
                100,
                $purpose
        );

        $dta->addExchange(
                {
                        name           => "John Doe",
                        bank_code      => "12345678",
                        account_number => "1234567890",
                },
                50,
                $purpose
        );

        print $dta->amount(); #would print 150

        print $dta->items(); #would print 2

        print $dta->sum_accounts(); # would print 2222222211

        print $dta->sum_bank_codes(); # would print 99999999

  getContent()
With getContent([ExecutionDate]) you get the content of the dta-file. The Parameter ExecutionDate is optional and gives the date of transfer. Format ExecutionDate as "DD.MM.[YY]YY" or as "YYYY-MM-DD"

        open(DAT, ">dta.txt") || die "$!";
        print DAT $dta->getContent(); # $dta->getContent("31.03.2017")
        close DAT;

BUGS
I am aware of no bugs - if you find one, please let me know, preferably you already have a solution ;)

CREDITS
This module was mainly created by Robert Urban (http://www.webcrew.de), when we were working together and needed a solution to handle a lot of credits, without typing until the fingers bleed. I merely did some minor changes and all the CPAN-work.

Matthias Schütze added the possibility to add an execution date to the dta-file and to retrieve the sums of the account numbers and/or bank codes, which is useful for control purposes. Thank you Matthias!

AUTHOR
Ben Schnopp, "<bsnoop at cpan.org>"

LICENSE AND COPYRIGHT
Copyright 2010 Ben Schnopp.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

POD ERRORS
Hey! The above document had some coding errors, which are explained below:

Around line 787:
    Non-ASCII character seen before =encoding in 'Schütze'. Assuming CP1252