-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
45 lines (35 loc) · 2.17 KB
/
index.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
<?php
use Laudeco\Mindee\Domain\Authentication\Token;
use Laudeco\Mindee\Domain\File\FilePath;
use Laudeco\Mindee\MindeeClientFactory;
require_once(__DIR__ . '/vendor/autoload.php');
$token = ''; // API Token
$file = __DIR__.''; //TODO change by a file
$client = MindeeClientFactory::financialDocument(new Token($token));
try {
$result = $client->parse(FilePath::fromPath($file));
echo "Supplier : " . $result->supplier()->getName() . "\n";
echo "Supplier Address: " . $result->supplier()->getAddress() . "\n";
echo "Supplier VAT: " . $result->supplier()->getVatNumber() . "\n";
echo "\n---------------------------------------------------------------------- \n";
echo "Customer: " . $result->customer()->getName() . "\n";
echo "Customer Address: " . $result->customer()->getAddress() . "\n";
echo "Customer VAT: " . $result->customer()->getVatNumber() . "\n";
echo "\n---------------------------------------------------------------------- \n";
echo "Date: " . $result->date()?->format('d-m-Y') . "\n";
echo "Date due: " . $result->dueDate()?->format('d-m-Y') . "\n";
echo "Reference: " . $result->reference() . "\n";
echo "\n---------------------------------------------------------------------- \n";
foreach($result->lines() as $item) {
echo "| {$item->getProductCode()}\t | {$item->getDescription()}\t | {$item->getQuantity()}\t | {$item->getUnitPrice()}\t | {$item->getTaxRate()}\t | {$item->getTaxeAmount()}\t | {$item->getTotalAmount()}\t |\n";
}
echo "\n---------------------------------------------------------------------- \n";
echo "Total: " . $result->totalGross() . "\n";
echo "Total net: " . $result->totalNet() . "\n";
echo "\n---------------------------------------------------------------------- \n";
foreach($result->supplier()->getPaymentDetailCollection() as $paymentDetail) {
echo "| {$paymentDetail->getIban()}\t | {$paymentDetail->getBic()}\t | {$paymentDetail->getAccountNumber()}\t | {$paymentDetail->getRoutingNumber()}\t | \n";
}
} catch (Exception $e) {
echo 'Exception when calling PredictApi->productsMindeeFinancialDocumentVersionPredictPost: ', $e->getMessage(), PHP_EOL;
}