PHP code example of spojenet / pohoda-sql

1. Go to this page and download the library: Download spojenet/pohoda-sql 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/ */

    

spojenet / pohoda-sql example snippets


$addr = new Adresar(234);
echo $addr->getDataValue('Firma'); // company name

$addr = new Adresar(['ICO' => '69438676']);
echo $addr->getDataValue('Email');

$addr = new Adresar(234, ['database' => 'StwPh_01234567_2020']);

$invoice = new Faktura(1001);
echo $invoice->getDataValue('Cislo');   // document number
echo $invoice->getDataValue('KcCelkem'); // total amount

$lines = new FakturaPolozka();
$rows  = $lines->getColumnsFromSQL(['Nazev', 'Mnozstvi', 'KcCena'], ['RefAg' => 1001]);
foreach ($rows as $row) {
    echo $row['Nazev'] . ' × ' . $row['Mnozstvi'] . ' = ' . $row['KcCena'] . PHP_EOL;
}

$addr = new Adresar();
$rows = $addr->getColumnsFromSQL(['Cislo', 'Firma', 'ADKreditMax'], ['ADKreditMax>' => 0]);
foreach ($rows as $row) {
    printf("%s  %s  (limit: %s)\n", $row['Cislo'], $row['Firma'], $row['ADKreditMax']);
}

$bv  = new BankovniVypis(['Cislo' => 'BV2024001']);
$pol = new BankovniVypisPol();
$items = $pol->getColumnsFromSQL(['KcCastka', 'VS', 'Datum'], ['RefBV' => $bv->getMyKey()]);

$zasilky = new Zasilka();
$list    = $zasilky->getColumnsFromSQL(['ID', 'Cislo', 'RefAD', 'DatOdeslani']);
foreach ($list as $z) {
    echo $z['Cislo'] . ' – ' . $z['DatOdeslani'] . PHP_EOL;
}

$zam = new Zamestnanec(['RodCisl' => '8001011234']);
echo $zam->getDataValue('Prijmeni') . ' ' . $zam->getDataValue('Jmeno');

use SpojeNet\PohodaSQL\Agenda;
use SpojeNet\PohodaSQL\DOC;

// Attach a SharePoint link to a bank statement (agenda = Agenda::BANK = 28)
$doc = new DOC();
$doc->setDataValue('RelAgID', Agenda::BANK);
$doc->urlAttachment(
    pohodaId: 303,                                          // DOC.RelID – internal Pohoda record ID
    url: 'https://sharepoint.example.com/statements/BV2024001.pdf',
    name: 'BV2024001.pdf',                                 // display name shown in Pohoda
);

// Attach a link to an issued invoice (agenda = Agenda::ISSUED_INVOICES = 2)
$doc = new DOC();
$doc->setDataValue('RelAgID', Agenda::ISSUED_INVOICES);
$doc->urlAttachment(1001, 'https://portal.example.com/invoice/1001', 'Invoice PDF');