invoicero

Crates.ioinvoicero
lib.rsinvoicero
version
sourcesrc
created_at2024-06-30 19:42:13.379913
updated_at2024-10-05 14:45:37.678968
descriptionCrate for generating cz/sk invoices
homepagehttps://github.com/Bleksak/invoicer
repositoryhttps://github.com/Bleksak/invoicer
max_upload_size
id1288166
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Jiří Velek (Bleksak)

documentation

README

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.")
);

Commit count: 17

cargo fmt