#invoice #ares #czech #generate

invoicero

Crate for generating cz/sk invoices

8 releases (stable)

1.0.5 Oct 5, 2024
1.0.3 Sep 24, 2024
0.1.1 Jul 5, 2024
0.1.0 Jun 30, 2024

#45 in Finance

Download history 163/week @ 2024-06-28 155/week @ 2024-07-05 2/week @ 2024-07-12 3/week @ 2024-09-13 573/week @ 2024-09-20 90/week @ 2024-09-27 307/week @ 2024-10-04 28/week @ 2024-10-11

998 downloads per month

MIT license

1.5MB
873 lines

Invoicer

Create CZ/SK invoices using Rust.

Make sure to use Decimal::new() to create Decimal values instead of dec!() macro.

use invoicer::Invoice;

let contractor = "contractor registration number (ičo)";
let iban = "your IBAN";
let due_days = 14;

let contractor: RegistrationNumber = contractor.parse().unwrap();
let client: RegistrationNumber = "client registration number".parse().unwrap();

let contractor: Entity = contractor.try_into().unwrap();
let client: Entity = client.try_into().unwrap();

let iban: Iban = iban.parse().unwrap();
let today = Utc::now().with_timezone(&Local).date_naive();
let due_date = today + Duration::days(due_days);

let invoice = Invoice::new(
    "202403".parse().unwrap(),
    contractor,
    client,
    iban,
    payment_method::PaymentMethod::BankTransfer("202403".to_string()),
    vec![
        InvoiceItem::new(
            InvoiceItemType::Hours(Time::new(1, 30)),
            "Položka faktury 1",
            Decimal::new(1234.0),
        ),
    ],
    today,
    due_date,
    Currency::CZK,
    Some("Fyzická osoba zapsaná v živnostenském rejstříku.")
);

Dependencies

~12–24MB
~377K SLoC