Package Exports
- @ribbery009/szamlazz-ts
- @ribbery009/szamlazz-ts/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ribbery009/szamlazz-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
szamlazz-ts
Enhanced TypeScript version of szamlazz.js with additional features like dijbekeroSzamlaszam support.
Features
- Full TypeScript support with type safety
- Compatible with original szamlazz.js API
- NEW:
dijbekeroSzamlaszamfield support for referencing proforma invoices - Support for multiple currencies, payment methods, and languages
- Full XML generation for Szamlazz.hu API
Installation
npm install szamlazz-tsUsage
Basic Invoice Creation
import { Invoice, Buyer, Item, Currencies, PaymentMethods, Languages, TaxSubjects } from 'szamlazz-ts'
// Create buyer
const buyer = new Buyer({
name: 'Example Company Ltd.',
country: 'Hungary',
zip: '1234',
city: 'Budapest',
address: 'Example Street 1.',
taxSubject: TaxSubjects.Company,
taxNumber: '12345678-1-23'
})
// Create item
const item = new Item({
label: 'Example Product',
quantity: 2,
unit: 'pcs',
vat: 27,
netUnitPrice: 1000
})
// Create invoice
const invoice = new Invoice({
buyer: buyer,
items: [item],
currency: Currencies.HUF,
paymentMethod: PaymentMethods.BankTransfer,
language: Languages.Hungarian
})Using dijbekeroSzamlaszam (NEW FEATURE!)
// Create prepayment invoice with reference to proforma
const prepaymentInvoice = new Invoice({
buyer: buyer,
items: [item],
currency: Currencies.HUF,
paymentMethod: PaymentMethods.BankTransfer,
prepaymentInvoice: true,
dijbekeroSzamlaszam: 'DIJB-2024-001' // Reference to proforma invoice
})Advance Invoice → Final Invoice Workflow (NEW!)
// 1. Create advance invoice (előlegszámla)
const advanceInvoice = new Invoice({
buyer: buyer,
items: [advanceItem], // Partial work/payment
prepaymentInvoice: true,
currency: Currencies.HUF
})
// 2. Create final invoice (végszámla) referencing the advance invoice
const finalInvoice = new Invoice({
buyer: buyer,
items: [fullWorkItems], // Complete work items
finalInvoice: true,
elolegSzamlaszam: 'ELOLEG-2024-001', // Reference to advance invoice
currency: Currencies.HUF
})This implements the complete Hungarian invoicing workflow for advance payments and final settlements.
API Reference
Invoice Options
issueDate?: Date - Invoice issue datefulfillmentDate?: Date - Service fulfillment datedueDate?: Date - Payment due datebuyer: Buyer - Invoice buyer (required)items: Item[] - Invoice items (required)currency?: Currency - Invoice currencypaymentMethod?: PaymentMethod - Payment methodlanguage?: Language - Invoice languageprepaymentInvoice?: boolean - Is prepayment invoice (előlegszámla)finalInvoice?: boolean - NEW! Is final invoice (végszámla)elolegSzamlaszam?: string - NEW! Reference to advance invoice numberdijbekeroSzamlaszam?: string - NEW! Reference to proforma invoice number
Constants
Currencies: Available currencies (HUF, EUR, USD, etc.)PaymentMethods: Available payment methodsLanguages: Available languagesTaxSubjects: Tax subject types
License
MIT
Migration from szamlazz.js
This package is fully compatible with the original szamlazz.js API. Simply replace:
// Old
import { Invoice } from 'szamlazz.js'
// New
import { Invoice } from 'szamlazz-ts'
// Everything works the same, plus you get TypeScript support and the new dijbekeroSzamlaszam field!