Crates.io | invoicero |
lib.rs | invoicero |
version | 1.0.5 |
created_at | 2024-06-30 19:42:13.379913+00 |
updated_at | 2024-10-05 14:45:37.678968+00 |
description | Crate for generating cz/sk invoices |
homepage | https://github.com/Bleksak/invoicer |
repository | https://github.com/Bleksak/invoicer |
max_upload_size | |
id | 1288166 |
size | 1,579,056 |
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.")
);