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 |
#77 in Finance
80 downloads per month
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
~13–25MB
~376K SLoC