Članci s tagom #fiskalizacija
-
Duplicate invoice number handling in production: graceful recovery without data loss
fiskalizacija_invoices UNIQUE KEY uq_company_invoice_number_year (company_id, invoice_number, issue_year GENERATED). generateInvoiceNumber MAX over all types including proformas (prevents proforma gap). PDOException catch on constraint name → 409 + 'invoice may already exist' (double-submit defence, no data loss). issue_year GENERATED ALWAYS AS YEAR(issue_date) STORED — same invoice number legal in different years.
-
AI OCR for invoice drafts in PHP: extracting structured data from PDFs and images
OcrInvoiceDraftTool: VisionAnalyzer 3 input modes (local PDF→document block, local image→image block, remote URL→cURL download→image block), TaskRouter::TASK_VISION, max_tokens=512 temperature=0.0. Extraction prompt: partner, dates, line_items (description/qty/unit_price/vat_rate), totals — Croatian VAT 0/5/13/25, OIB 11 digits, EUR default. parseJsonStrict strips code fences. Draft-only safety: never writes to DB, status=draft, operator fiscalizes manually.
-
PDF invoice generation in PHP: pure binary PDF with embedded DejaVu Sans, no library
Fiskalizacija PDF: two-path architecture — HTML preview (InvoicePdfService, browser print) vs binary PDF download (PdfService pure PHP, DejaVu Sans TTF embedded, A4 595.28×841.89pt, PDF objects directly). QR code via QrCodeService::generateSvg() (pure PHP SVG). HUB-3 payment slip HTML. Fiscalization block: ZKI formatted groups, JIR or 'naknadna dostava pending'. Croatian characters: ć/č/š/ž/đ require Unicode TTF embedding.
-
SOAP in PHP without ext-soap: building the Croatian CIS fiscal connector
CisClient: raw SOAP envelope as PHP string (no ext-soap), 8-step XML-DSig (enveloped, exc-c14n, RSA-SHA1): SHA1 digest of RacunZahtjev → X509Certificate+IssuerSerial → SignedInfo string → PLACEHOLDER Signature inserted → C14N in doc context → openssl_sign → PLACEHOLDER replaced. Client cert via CURLOPT_SSLCERT+SSLKEY (tempnam 0600, cleanup in finally). FINA RDC CA not in Mozilla bundle → custom cacert.pem. SafeXmlLoader LIBXML_NONET+DOCTYPE guard on response.
-
Croatian fiscal invoicing (fiskalizacija) in PHP: SOAP, PKCS12, ZKI, JIR — the complete guide
Fiskalizacija module: Zakon o fiskalizaciji CIS SOAP over HTTPS with XML-DSig (enveloped, exc-c14n, RSA-SHA1, X509Certificate+IssuerSerial), PKCS12 AES-256 encrypted in DB, ZkiGeneratorService (MD5 of concatenated fields), JIR from CIS response, naknadna dostava retry (FiskNaknadnaJob 30min × 10, 48h legal deadline, Telegram alert), 5 AI agents (FiskAgent draft-only), KPD mandatory 2026-01-01, QR code SVG pure PHP.