summaryrefslogtreecommitdiff
path: root/src/invoice.h
diff options
context:
space:
mode:
authorAnders Betts <anders.betts@gmail.com>2026-09-20 15:08:58 +0200
committerAnders Betts <anders.betts@gmail.com>2026-09-20 15:08:58 +0200
commitfb21e8efa65662dcb6c2cc7ed693dea91888c3a7 (patch)
tree43f0662b2c61dd596e2be78fdd107463e8aa9591 /src/invoice.h
parent480640a747b81cb39deb1ec24e6e199a9c837fbe (diff)
downloadbokf-fb21e8efa65662dcb6c2cc7ed693dea91888c3a7.tar.gz
bokf-fb21e8efa65662dcb6c2cc7ed693dea91888c3a7.zip
invoice: render the document as PDF
Diffstat (limited to 'src/invoice.h')
-rw-r--r--src/invoice.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/invoice.h b/src/invoice.h
new file mode 100644
index 0000000..c92677d
--- /dev/null
+++ b/src/invoice.h
@@ -0,0 +1,66 @@
+#ifndef BOKF_INVOICE_H
+#define BOKF_INVOICE_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+struct invoice_seller {
+ const char *name;
+ const char *address;
+ const char *postal_code;
+ const char *city;
+ const char *phone;
+ const char *email;
+ const char *org_nr;
+ const char *vat_nr;
+ const char *bankgiro;
+};
+
+struct invoice_customer {
+ const char *name;
+ const char *address;
+ const char *postal_code;
+ const char *city;
+ const char *vat_nr;
+};
+
+struct invoice_line {
+ const char *article_no;
+ const char *description;
+ int64_t quantity_milli;
+ const char *unit;
+ int64_t unit_price_ore;
+ int64_t amount_ore;
+ const char *note;
+ const char *vat_code;
+};
+
+struct invoice_doc {
+ struct invoice_seller seller;
+ struct invoice_customer customer;
+ int64_t number;
+ const char *ocr;
+ const char *invoice_date;
+ const char *due_date;
+ const char *delivery_date;
+ const char *our_ref;
+ const char *your_ref;
+ const char *notes;
+ int payment_days;
+ const struct invoice_line *lines;
+ size_t nlines;
+};
+
+struct invoice_totals {
+ int64_t net_ore;
+ int64_t vat_ore;
+ int64_t total_ore;
+ int64_t net_25, net_12, net_6, net_free;
+};
+
+void invoice_totals(const struct invoice_doc *d, struct invoice_totals *t);
+int invoice_ocr_check(const char *number_digits);
+int invoice_render_pdf(const struct invoice_doc *d, unsigned char **out,
+ size_t *len);
+
+#endif