Commit Graph

59 Commits

Author SHA1 Message Date
jordi fita mas 97ef02b0f9 Add views to compute taxes and total amount of invoices
They are not functions because i need to join them with the main
invoice relation, and although possible is a bit more awkward with
functions.

The taxes have their own relation because i will need them grouped by
their name in the PDF, so it will probably be a select for that
relation.
2023-02-22 14:39:38 +01:00
jordi fita mas 32fdab4217 Reindex product indices when removing
When updating the product list, i forgot to change the index in the
product field’s names and, therefore, i created invoices with only the
products until the first gap.
2023-02-21 13:57:40 +01:00
jordi fita mas b3004486f0 Properly register array and composite PostgreSQL types with pgtype
I have moved everything into a different file, even though it is related
to “db”, because it was starting to get a bit ugly.

Apparently i was doing too much work and had to read the code to
understand what i was supposed to do, because pgtypes’ documentation,
as all other projects from the same author, is almost non-existent.
2023-02-20 11:42:21 +01:00
jordi fita mas 98ac17a129 Call add_invoice when adding invoice from Go
I needed to add binary encoding function for the new_invoice_product
type, and currently it is not correct: i hardcoded the OID values, but
they are going to be different on a different database.
2023-02-19 23:53:06 +01:00
jordi fita mas 045bf7ff6a Add the formnovalidate attribute to update and add products buttons
They are to complete the invoice, so it can be in an invalid date, but
we do not want to force people to finish all required inputs before they
can add products or update quantities, do we?

Now had to add the empty option label for customer in all cases, because
it could be empty, although that should be done regardless in case
someone has a browser that does not validate fields.
2023-02-14 12:55:19 +01:00
jordi fita mas 989c1717e5 Rename mustGetInvoiceEntries to mustCollectInvoiceEntries
I have seen that pgx has the CollectRows function to do the same job as
that function.  I can not use CollectRows because it uses generics and
requires Go 1.18, but i have adopted the same nomenclature they use.
2023-02-14 12:34:50 +01:00
jordi fita mas 3891a01fd5 Fix use of API methods not available in Go 1.16
Apparently, url.Values.Has and math.MaxInt was added to Go 1.17,
but on Debian Bullseye there is only Go 1.16.  I do not want to
install a new version of Go to the server unless there is an
overwhelming reason, and a couple of methods are not.  Thus, now i use
Go 1.16 too on my development machine, to avoid situations like this.
2023-02-13 10:32:26 +01:00
jordi fita mas 4903c8a3b9 Add the form to add products to an invoice and create invoices too
Still missing: the invoice number, that requires more tables and
possibly a PL/pgSQL function to do it properly.
2023-02-12 21:06:48 +01:00
jordi fita mas 5c15b9de20 Add the bare-bones form for invoices 2023-02-11 22:16:48 +01:00