-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathParujPrijateFaktury.php
49 lines (40 loc) · 1.63 KB
/
ParujPrijateFaktury.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
declare(strict_types=1);
/**
* This file is part of the AbraFlexi Matcher package.
*
* (c) Vítězslav Dvořák <https://vitexsoftware.cz/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use AbraFlexi\Matcher\IncomingInvoice;
use Ease\Shared;
\define('APP_NAME', 'AbraFlexi ParujPrijateFaktury');
require_once '../vendor/autoload.php';
\Ease\Shared::init(['ABRAFLEXI_URL', 'ABRAFLEXI_LOGIN', 'ABRAFLEXI_PASSWORD', 'ABRAFLEXI_COMPANY'], \array_key_exists(1, $argv) ? $argv[1] : '../.env');
new \Ease\Locale(Shared::cfg('MATCHER_LOCALIZE'), '../i18n', 'abraflexi-matcher');
$invoiceSteamer = new IncomingInvoice();
if (Shared::cfg('APP_DEBUG')) {
$invoiceSteamer->banker->logBanner();
}
if (Shared::cfg('MATCHER_PULL_BANK', false)) {
$invoiceSteamer->addStatusMessage(_('pull account statements'), 'debug');
try {
if (!$invoiceSteamer->banker->stahnoutVypisyOnline()) {
$invoiceSteamer->addStatusMessage(_('Bank Offline!'), 'error');
}
} catch (\Exception $exc) {
$invoiceSteamer->addStatusMessage($exc->getMessage(), 'error');
}
}
$begin = new DateTime();
$daterange = new DatePeriod(
$begin->modify('-'.Shared::cfg('MATCHER_DAYS_BACK', 365).' days'),
new DateInterval('P1D'),
new DateTime(),
);
$invoiceSteamer->addStatusMessage(_('Incoming Invoice matching begin'), 'debug');
// TODO Variabilni symbol je nespolehlivy, parovat nejprve podle bankovniho uctu
$invoiceSteamer->inInvoicesMatchingByBank($daterange);
$invoiceSteamer->addStatusMessage(_('Incoming Invoice matching done'), 'debug');