-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathParujFakturyNew2Old.php
49 lines (38 loc) · 1.55 KB
/
ParujFakturyNew2Old.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\OutgoingInvoice;
use Ease\Shared;
\define('APP_NAME', 'AbraFlexi ParujFakturyNewToOld');
require_once '../vendor/autoload.php';
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');
$odden = 0;
$date1 = new DateTime();
$date2 = new DateTime();
$daysOfYear = \AbraFlexi\FakturaVydana::overdueDays(new \AbraFlexi\Date(date('Y').'-01-01'));
$date2->modify('-'.Shared::cfg('MATCHER_DAYS_BACK', $daysOfYear).' days');
$doden = $date2->diff($date1)->format('%a');
$invoiceSteamer = new OutgoingInvoice();
if (Shared::cfg('APP_DEBUG')) {
$invoiceSteamer->banker->logBanner();
}
if (Shared::cfg('MATCHER_PULL_BANK') === true) {
$invoiceSteamer->addStatusMessage(_('pull account statements'));
if (!$invoiceSteamer->banker->stahnoutVypisyOnline()) {
$invoiceSteamer->addStatusMessage('Banka Offline!', 'error');
}
}
$invoiceSteamer->addStatusMessage(_('Matching program started'), 'debug');
while ($odden < $doden) {
$invoiceSteamer->setStartDay($odden++);
$invoiceSteamer->issuedInvoicesMatchingByBank();
}
$invoiceSteamer->addStatusMessage(_('Matching finished'));