1. Go to this page and download the library: Download 63pokupki/yii2-taxcom-sdk 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/ */
63pokupki / yii2-taxcom-sdk example snippets
use pokupki63\Taxcom\Client;
use pokupki63\Taxcom\Model\Document;
use pokupki63\Taxcom\Request\Login;
use pokupki63\Taxcom\Taxcom;
// Инициализируем такском API клиент
$client = new Client(
// api-lk-ofd.taxcom.ru - боевой, api-tlk-ofd.taxcom.ru - тестовый
'api-tlk-ofd.taxcom.ru',
new Login([
'login' => 'логин',
'password' => 'пароль',
'agreementNumber' => 'номер договора',
]),
'ID итегратора'
);
$taxcom = new Taxcom($client);
// Список офисов
$outletList = $taxcom->getOutletList();
foreach ($outletList as $outlet) {
echo 'Офис: ' . $outlet->name . PHP_EOL;
// Список касс
$cashDeskList = $taxcom->getCashDeskList($outlet);
foreach ($cashDeskList as $cashDesk) {
echo "\tкасса #{$cashDesk->fnFactoryNumber} (рег. номер {$cashDesk->kktRegNumber})" . PHP_EOL;
// Список смен на кассе
$shiftList = $taxcom->getShiftList($cashDesk);
foreach ($shiftList as $shift) {
echo "\t\tсмена №" . $shift->shiftNumber . PHP_EOL;
// Список документов (чеки) смены
$docList = $taxcom->getDocumentList($shift, Document::TYPE_CHECK);
foreach ($docList as $doc) {
// ФФД теги документа
$docTag = $taxcom->getDocumentTag($doc);
$sum = round($doc->sum / 100, 2);
echo $this->getLogMessage("\t\t\tФД №{$doc->fdNumber} {$sum} рублей");
}
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.