PHP code example of firebed / aade-mydata

1. Go to this page and download the library: Download firebed/aade-mydata library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

firebed / aade-mydata example snippets


use Firebed\AadeMyData\Enums\InvoiceType;
use Firebed\AadeMyData\Services\Classifications;

dump(Classifications::incomeClassifications(InvoiceType::TYPE_1_1));

use Firebed\AadeMyData\Enums\InvoiceType;
use Firebed\AadeMyData\Services\Classifications;

dump(Classifications::incomeClassifications(InvoiceType::TYPE_1_1)->toKeyLabel());
dump(Classifications::incomeClassifications(InvoiceType::TYPE_1_1)->toKeyLabels())
dump(Classifications::incomeClassifications(InvoiceType::TYPE_1_1, IncomeClassificationCategory::CATEGORY_1_1)->toKeyLabel())

use Firebed\AadeMyData\Enums\InvoiceType;
use Firebed\AadeMyData\Enums\IncomeClassificationCategory;
use Firebed\AadeMyData\Enums\IncomeClassificationType;
use Firebed\AadeMyData\Services\Classifications;

Classifications::incomeClassificationExists('1.1', 'category1_1', 'E3_561_001');
// or
Classifications::incomeClassificationExists(InvoiceType::TYPE_1_1, IncomeClassificationCategory::CATEGORY_1_1, IncomeClassificationType::E3_561_001);
// Outputs: true

// Same for expense classifications
Classifications::expenseClassificationExists('1.1', 'category2_1', 'E3_102_001');

use Firebed\AadeMyData\Enums\InvoiceType;
use Firebed\AadeMyData\Enums\PaymentMethod;
use Firebed\AadeMyData\Enums\VatCategory;
use Firebed\AadeMyData\Enums\CountryCode;

echo InvoiceType::TYPE_1_1->label();
// Outputs: Τιμολόγιο Πώλησης

echo InvoiceType::TYPE_1_2->label();
// Outputs: Τιμολόγιο Πώλησης / Ενδοκοινοτικές Παραδόσεις

echo PaymentMethod::METHOD_5->label();
// Outputs: Επί Πιστώσει

echo VatCategory::VAT_1->label();
// Outputs: ΦΠΑ συντελεστής 24%

echo CountryCode::BE->label();
// Outputs: Βέλγιο

use Firebed\AadeMyData\Enums\InvoiceType;
use Firebed\AadeMyData\Enums\CountryCode;
use Firebed\AadeMyData\Enums\ExpenseClassificationType;

$invoiceType = InvoiceType::TYPE_1_1;
$invoiceType->supportsFuelInvoice();
$invoiceType->hasCounterpart();
$invoiceType->supportsDeliveryNote();
$invoiceType->supportsSelfPricing();
$invoiceType->supportsTaxFree();

var_dump(CountryCode::europeanUnionCountries());
// Outputs: All countries in the European Union

echo CountryCode::BE->isInEuropeanUnion()
// Outputs: true

echo CountryCode::US->isInEuropeanUnion()
// Outputs: false

$type = ExpenseClassificationType::VAT_361;
echo $type->isVatClassification(); // true

var_dump(ExpenseClassificationType::vatClassifications()); // Array of all vat classifications

use Firebed\AadeMyData\Models\InvoiceDetails;
use Firebed\AadeMyData\Enums\RecType;
use Firebed\AadeMyData\Enums\IncomeClassificationType;
use Firebed\AadeMyData\Enums\IncomeClassificationCategory;

new InvoiceDetails([
  'lineNumber' => 1,
  'netValue' => 5,
  'recType' => RecType::TYPE_2,
  'incomeClassification' => [
      [
          'classificationType' => IncomeClassificationType::E3_561_001,
          'classificationCategory' => IncomeClassificationCategory::CATEGORY_1_1,
          'amount' => '5'
      ]
  ]
])

$row->addNetValue(5);
$row->addVatAmount(1.2);

$env = "dev"; // For production use "prod"
$user_id = "your-user-id";
$subscription_key = "your-subscription-key";

MyDataRequest::setEnvironment($env);
MyDataRequest::setCredentials($user_id, $subscription_key);

MyDataRequest::verifyClient(false);