Add the base and tax columns to expenses’ index

Closes #80
This commit is contained in:
jordi fita mas 2023-10-02 12:16:50 +02:00
parent 60ec335769
commit 831becf6fd
4 changed files with 121 additions and 81 deletions

View File

@ -17,6 +17,8 @@ type ExpenseEntry struct {
InvoiceDate time.Time
InvoiceNumber string
Amount string
Taxes map[string]string
Total string
InvoicerName string
OriginalFileName string
Tags []string
@ -28,6 +30,7 @@ type expensesIndexPage struct {
Expenses []*ExpenseEntry
TotalAmount string
Filters *expenseFilterForm
TaxClasses []string
ExpenseStatuses map[string]string
}
@ -44,6 +47,7 @@ func IndexExpenses(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
Expenses: mustCollectExpenseEntries(r.Context(), conn, locale, filters),
TotalAmount: mustComputeExpensesTotalAmount(r.Context(), conn, filters),
ExpenseStatuses: mustCollectExpenseStatuses(r.Context(), conn, locale),
TaxClasses: mustCollectTaxClasses(r.Context(), conn, company),
Filters: filters,
}
mustRenderMainTemplate(w, r, "expenses/index.gohtml", page)
@ -55,7 +59,9 @@ func mustCollectExpenseEntries(ctx context.Context, conn *Conn, locale *Locale,
select expense.slug
, invoice_date
, invoice_number
, to_price(expense.amount + coalesce(sum(tax.amount)::integer, 0), decimal_digits) as total
, to_price(expense.amount, decimal_digits) as amount
, array_agg(array[tax_class.name, to_price(coalesce(expense_tax.amount, 0), decimal_digits)]) filter (where tax_class.name is not null)
, to_price(expense.amount + coalesce(sum(expense_tax.amount)::integer, 0), decimal_digits) as total
, contact.name
, coalesce(attachment.original_filename, '')
, expense.tags
@ -63,7 +69,9 @@ func mustCollectExpenseEntries(ctx context.Context, conn *Conn, locale *Locale,
, esi18n.name
from expense
left join expense_attachment as attachment using (expense_id)
left join expense_tax_amount as tax using (expense_id)
left join expense_tax_amount as expense_tax using (expense_id)
left join tax using (tax_id)
left join tax_class using (tax_class_id)
join contact using (contact_id)
join expense_status_i18n esi18n on expense.expense_status = esi18n.expense_status and esi18n.lang_tag = $1
join currency using (currency_code)
@ -84,10 +92,16 @@ func mustCollectExpenseEntries(ctx context.Context, conn *Conn, locale *Locale,
var entries []*ExpenseEntry
for rows.Next() {
entry := &ExpenseEntry{}
if err := rows.Scan(&entry.Slug, &entry.InvoiceDate, &entry.InvoiceNumber, &entry.Amount, &entry.InvoicerName, &entry.OriginalFileName, &entry.Tags, &entry.Status, &entry.StatusLabel); err != nil {
entry := &ExpenseEntry{
Taxes: make(map[string]string),
}
var taxes [][]string
if err := rows.Scan(&entry.Slug, &entry.InvoiceDate, &entry.InvoiceNumber, &entry.Amount, &taxes, &entry.Total, &entry.InvoicerName, &entry.OriginalFileName, &entry.Tags, &entry.Status, &entry.StatusLabel); err != nil {
panic(err)
}
for _, tax := range taxes {
entry.Taxes[tax[0]] = tax[1]
}
entries = append(entries, entry)
}
if rows.Err() != nil {
@ -143,6 +157,21 @@ func mustComputeExpensesTotalAmount(ctx context.Context, conn *Conn, filters *ex
`, where), args...)
}
func mustCollectTaxClasses(ctx context.Context, conn *Conn, company *Company) []string {
rows := conn.MustQuery(ctx, "select name from tax_class where company_id = $1", company.Id)
defer rows.Close()
var taxClasses []string
for rows.Next() {
var taxClass string
if err := rows.Scan(&taxClass); err != nil {
panic(err)
}
taxClasses = append(taxClasses, taxClass)
}
return taxClasses
}
func ServeExpenseForm(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
locale := getLocale(r)
conn := getConn(r)

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-07-18 13:12+0200\n"
"POT-Creation-Date: 2023-10-02 12:11+0200\n"
"PO-Revision-Date: 2023-01-18 17:08+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\n"
@ -105,7 +105,8 @@ msgstr "Subtotal"
#: web/template/invoices/view.gohtml:115 web/template/invoices/edit.gohtml:75
#: web/template/quotes/new.gohtml:74 web/template/quotes/view.gohtml:82
#: web/template/quotes/view.gohtml:122 web/template/quotes/edit.gohtml:75
#: web/template/expenses/new.gohtml:47 web/template/expenses/edit.gohtml:49
#: web/template/expenses/new.gohtml:47 web/template/expenses/index.gohtml:74
#: web/template/expenses/edit.gohtml:49
msgctxt "title"
msgid "Total"
msgstr "Total"
@ -197,13 +198,13 @@ msgid "Amount"
msgstr "Import"
#: web/template/invoices/index.gohtml:73 web/template/quotes/index.gohtml:73
#: web/template/expenses/index.gohtml:71
#: web/template/expenses/index.gohtml:75
msgctxt "title"
msgid "Download"
msgstr "Descàrrega"
#: web/template/invoices/index.gohtml:74 web/template/quotes/index.gohtml:74
#: web/template/contacts/index.gohtml:51 web/template/expenses/index.gohtml:72
#: web/template/contacts/index.gohtml:51 web/template/expenses/index.gohtml:76
#: web/template/products/index.gohtml:48
msgctxt "title"
msgid "Actions"
@ -225,7 +226,7 @@ msgstr "Accions per la factura %s"
#: web/template/invoices/index.gohtml:138 web/template/invoices/view.gohtml:19
#: web/template/quotes/index.gohtml:137 web/template/quotes/view.gohtml:22
#: web/template/contacts/index.gohtml:82 web/template/expenses/index.gohtml:134
#: web/template/contacts/index.gohtml:82 web/template/expenses/index.gohtml:143
#: web/template/products/index.gohtml:78
msgctxt "action"
msgid "Edit"
@ -242,7 +243,7 @@ msgid "No invoices added yet."
msgstr "No hi ha cap factura."
#: web/template/invoices/index.gohtml:163 web/template/quotes/index.gohtml:170
#: web/template/expenses/index.gohtml:151
#: web/template/expenses/index.gohtml:160
msgid "Total"
msgstr "Total"
@ -590,11 +591,11 @@ msgctxt "title"
msgid "Invoice Number"
msgstr "Número de factura"
#: web/template/expenses/index.gohtml:126
#: web/template/expenses/index.gohtml:135
msgid "Actions for expense %s"
msgstr "Accions per la despesa %s"
#: web/template/expenses/index.gohtml:144
#: web/template/expenses/index.gohtml:153
msgid "No expenses added yet."
msgstr "No hi ha cap despesa."
@ -734,37 +735,37 @@ msgid "Name"
msgstr "Nom"
#: pkg/products.go:177 pkg/products.go:303 pkg/quote.go:174 pkg/quote.go:708
#: pkg/expenses.go:278 pkg/expenses.go:442 pkg/invoices.go:174
#: pkg/expenses.go:307 pkg/expenses.go:471 pkg/invoices.go:174
#: pkg/invoices.go:746 pkg/invoices.go:1331 pkg/contacts.go:154
#: pkg/contacts.go:362
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:452 pkg/invoices.go:178
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:481 pkg/invoices.go:178
#: pkg/contacts.go:158
msgctxt "input"
msgid "Tags Condition"
msgstr "Condició de les etiquetes"
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:456 pkg/invoices.go:182
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:485 pkg/invoices.go:182
#: pkg/contacts.go:162
msgctxt "tag condition"
msgid "All"
msgstr "Totes"
#: pkg/products.go:186 pkg/expenses.go:457 pkg/invoices.go:183
#: pkg/products.go:186 pkg/expenses.go:486 pkg/invoices.go:183
#: pkg/contacts.go:163
msgid "Invoices must have all the specified labels."
msgstr "Les factures han de tenir totes les etiquetes."
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:461 pkg/invoices.go:187
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:490 pkg/invoices.go:187
#: pkg/contacts.go:167
msgctxt "tag condition"
msgid "Any"
msgstr "Qualsevol"
#: pkg/products.go:191 pkg/expenses.go:462 pkg/invoices.go:188
#: pkg/products.go:191 pkg/expenses.go:491 pkg/invoices.go:188
#: pkg/contacts.go:168
msgid "Invoices must have at least one of the specified labels."
msgstr "Les factures han de tenir com a mínim una de les etiquetes."
@ -779,7 +780,7 @@ msgctxt "input"
msgid "Price"
msgstr "Preu"
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:246
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:275
#: pkg/invoices.go:1063
msgctxt "input"
msgid "Taxes"
@ -798,12 +799,12 @@ msgstr "No podeu deixar el preu en blanc."
msgid "Price must be a number greater than zero."
msgstr "El preu ha de ser un número major a zero."
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:314
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:343
#: pkg/invoices.go:1122
msgid "Selected tax is not valid."
msgstr "Heu seleccionat un impost que no és vàlid."
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:315
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:344
#: pkg/invoices.go:1123
msgid "You can only select a tax of each class."
msgstr "Només podeu seleccionar un impost de cada classe."
@ -1027,7 +1028,7 @@ msgctxt "input"
msgid "Quotation Status"
msgstr "Estat del pressupost"
#: pkg/quote.go:154 pkg/expenses.go:447 pkg/invoices.go:154
#: pkg/quote.go:154 pkg/expenses.go:476 pkg/invoices.go:154
msgid "All status"
msgstr "Tots els estats"
@ -1036,12 +1037,12 @@ msgctxt "input"
msgid "Quotation Number"
msgstr "Número de pressupost"
#: pkg/quote.go:164 pkg/expenses.go:432 pkg/invoices.go:164
#: pkg/quote.go:164 pkg/expenses.go:461 pkg/invoices.go:164
msgctxt "input"
msgid "From Date"
msgstr "A partir de la data"
#: pkg/quote.go:169 pkg/expenses.go:437 pkg/invoices.go:169
#: pkg/quote.go:169 pkg/expenses.go:466 pkg/invoices.go:169
msgctxt "input"
msgid "To Date"
msgstr "Fins la data"
@ -1062,8 +1063,8 @@ msgstr "pressuposts.zip"
msgid "quotations.ods"
msgstr "pressuposts.ods"
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:651
#: pkg/expenses.go:677 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:680
#: pkg/expenses.go:706 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/invoices.go:1314
msgid "Invalid action"
msgstr "Acció invàlida."
@ -1218,70 +1219,70 @@ msgctxt "period option"
msgid "Previous year"
msgstr "Any anterior"
#: pkg/expenses.go:172
#: pkg/expenses.go:201
msgid "Select a contact."
msgstr "Escolliu un contacte."
#: pkg/expenses.go:229 pkg/expenses.go:421
#: pkg/expenses.go:258 pkg/expenses.go:450
msgctxt "input"
msgid "Contact"
msgstr "Contacte"
#: pkg/expenses.go:235
#: pkg/expenses.go:264
msgctxt "input"
msgid "Invoice number"
msgstr "Número de factura"
#: pkg/expenses.go:240 pkg/invoices.go:735
#: pkg/expenses.go:269 pkg/invoices.go:735
msgctxt "input"
msgid "Invoice Date"
msgstr "Data de factura"
#: pkg/expenses.go:255
#: pkg/expenses.go:284
msgctxt "input"
msgid "Amount"
msgstr "Import"
#: pkg/expenses.go:266 pkg/invoices.go:757
#: pkg/expenses.go:295 pkg/invoices.go:757
msgctxt "input"
msgid "File"
msgstr "Fitxer"
#: pkg/expenses.go:272 pkg/expenses.go:446
#: pkg/expenses.go:301 pkg/expenses.go:475
msgctxt "input"
msgid "Expense Status"
msgstr "Estat de la despesa"
#: pkg/expenses.go:312
#: pkg/expenses.go:341
msgid "Selected contact is not valid."
msgstr "Heu seleccionat un contacte que no és vàlid."
#: pkg/expenses.go:313 pkg/invoices.go:808
#: pkg/expenses.go:342 pkg/invoices.go:808
msgid "Invoice date must be a valid date."
msgstr "La data de facturació ha de ser vàlida."
#: pkg/expenses.go:316
#: pkg/expenses.go:345
msgid "Amount can not be empty."
msgstr "No podeu deixar limport en blanc."
#: pkg/expenses.go:317
#: pkg/expenses.go:346
msgid "Amount must be a number greater than zero."
msgstr "Limport ha de ser un número major a zero."
#: pkg/expenses.go:319
#: pkg/expenses.go:348
msgid "Selected expense status is not valid."
msgstr "Heu seleccionat un estat de despesa que no és vàlid."
#: pkg/expenses.go:422
#: pkg/expenses.go:451
msgid "All contacts"
msgstr "Tots els contactes"
#: pkg/expenses.go:427 pkg/invoices.go:159
#: pkg/expenses.go:456 pkg/invoices.go:159
msgctxt "input"
msgid "Invoice Number"
msgstr "Número de factura"
#: pkg/expenses.go:675
#: pkg/expenses.go:704
msgid "expenses.ods"
msgstr "despeses.ods"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: numerus\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2023-07-18 13:12+0200\n"
"POT-Creation-Date: 2023-10-02 12:11+0200\n"
"PO-Revision-Date: 2023-01-18 17:45+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
@ -105,7 +105,8 @@ msgstr "Subtotal"
#: web/template/invoices/view.gohtml:115 web/template/invoices/edit.gohtml:75
#: web/template/quotes/new.gohtml:74 web/template/quotes/view.gohtml:82
#: web/template/quotes/view.gohtml:122 web/template/quotes/edit.gohtml:75
#: web/template/expenses/new.gohtml:47 web/template/expenses/edit.gohtml:49
#: web/template/expenses/new.gohtml:47 web/template/expenses/index.gohtml:74
#: web/template/expenses/edit.gohtml:49
msgctxt "title"
msgid "Total"
msgstr "Total"
@ -197,13 +198,13 @@ msgid "Amount"
msgstr "Importe"
#: web/template/invoices/index.gohtml:73 web/template/quotes/index.gohtml:73
#: web/template/expenses/index.gohtml:71
#: web/template/expenses/index.gohtml:75
msgctxt "title"
msgid "Download"
msgstr "Descargar"
#: web/template/invoices/index.gohtml:74 web/template/quotes/index.gohtml:74
#: web/template/contacts/index.gohtml:51 web/template/expenses/index.gohtml:72
#: web/template/contacts/index.gohtml:51 web/template/expenses/index.gohtml:76
#: web/template/products/index.gohtml:48
msgctxt "title"
msgid "Actions"
@ -225,7 +226,7 @@ msgstr "Acciones para la factura %s"
#: web/template/invoices/index.gohtml:138 web/template/invoices/view.gohtml:19
#: web/template/quotes/index.gohtml:137 web/template/quotes/view.gohtml:22
#: web/template/contacts/index.gohtml:82 web/template/expenses/index.gohtml:134
#: web/template/contacts/index.gohtml:82 web/template/expenses/index.gohtml:143
#: web/template/products/index.gohtml:78
msgctxt "action"
msgid "Edit"
@ -242,7 +243,7 @@ msgid "No invoices added yet."
msgstr "No hay facturas."
#: web/template/invoices/index.gohtml:163 web/template/quotes/index.gohtml:170
#: web/template/expenses/index.gohtml:151
#: web/template/expenses/index.gohtml:160
msgid "Total"
msgstr "Total"
@ -590,11 +591,11 @@ msgctxt "title"
msgid "Invoice Number"
msgstr "Número de factura"
#: web/template/expenses/index.gohtml:126
#: web/template/expenses/index.gohtml:135
msgid "Actions for expense %s"
msgstr "Acciones para el gasto %s"
#: web/template/expenses/index.gohtml:144
#: web/template/expenses/index.gohtml:153
msgid "No expenses added yet."
msgstr "No hay gastos."
@ -734,37 +735,37 @@ msgid "Name"
msgstr "Nombre"
#: pkg/products.go:177 pkg/products.go:303 pkg/quote.go:174 pkg/quote.go:708
#: pkg/expenses.go:278 pkg/expenses.go:442 pkg/invoices.go:174
#: pkg/expenses.go:307 pkg/expenses.go:471 pkg/invoices.go:174
#: pkg/invoices.go:746 pkg/invoices.go:1331 pkg/contacts.go:154
#: pkg/contacts.go:362
msgctxt "input"
msgid "Tags"
msgstr "Etiquetes"
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:452 pkg/invoices.go:178
#: pkg/products.go:181 pkg/quote.go:178 pkg/expenses.go:481 pkg/invoices.go:178
#: pkg/contacts.go:158
msgctxt "input"
msgid "Tags Condition"
msgstr "Condición de las etiquetas"
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:456 pkg/invoices.go:182
#: pkg/products.go:185 pkg/quote.go:182 pkg/expenses.go:485 pkg/invoices.go:182
#: pkg/contacts.go:162
msgctxt "tag condition"
msgid "All"
msgstr "Todas"
#: pkg/products.go:186 pkg/expenses.go:457 pkg/invoices.go:183
#: pkg/products.go:186 pkg/expenses.go:486 pkg/invoices.go:183
#: pkg/contacts.go:163
msgid "Invoices must have all the specified labels."
msgstr "Las facturas deben tener todas las etiquetas."
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:461 pkg/invoices.go:187
#: pkg/products.go:190 pkg/quote.go:187 pkg/expenses.go:490 pkg/invoices.go:187
#: pkg/contacts.go:167
msgctxt "tag condition"
msgid "Any"
msgstr "Cualquiera"
#: pkg/products.go:191 pkg/expenses.go:462 pkg/invoices.go:188
#: pkg/products.go:191 pkg/expenses.go:491 pkg/invoices.go:188
#: pkg/contacts.go:168
msgid "Invoices must have at least one of the specified labels."
msgstr "Las facturas deben tener como mínimo una de las etiquetas."
@ -779,7 +780,7 @@ msgctxt "input"
msgid "Price"
msgstr "Precio"
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:246
#: pkg/products.go:297 pkg/quote.go:948 pkg/expenses.go:275
#: pkg/invoices.go:1063
msgctxt "input"
msgid "Taxes"
@ -798,12 +799,12 @@ msgstr "No podéis dejar el precio en blanco."
msgid "Price must be a number greater than zero."
msgstr "El precio tiene que ser un número mayor a cero."
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:314
#: pkg/products.go:326 pkg/quote.go:1007 pkg/expenses.go:343
#: pkg/invoices.go:1122
msgid "Selected tax is not valid."
msgstr "Habéis escogido un impuesto que no es válido."
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:315
#: pkg/products.go:327 pkg/quote.go:1008 pkg/expenses.go:344
#: pkg/invoices.go:1123
msgid "You can only select a tax of each class."
msgstr "Solo podéis escoger un impuesto de cada clase."
@ -1027,7 +1028,7 @@ msgctxt "input"
msgid "Quotation Status"
msgstr "Estado del presupuesto"
#: pkg/quote.go:154 pkg/expenses.go:447 pkg/invoices.go:154
#: pkg/quote.go:154 pkg/expenses.go:476 pkg/invoices.go:154
msgid "All status"
msgstr "Todos los estados"
@ -1036,12 +1037,12 @@ msgctxt "input"
msgid "Quotation Number"
msgstr "Número de presupuesto"
#: pkg/quote.go:164 pkg/expenses.go:432 pkg/invoices.go:164
#: pkg/quote.go:164 pkg/expenses.go:461 pkg/invoices.go:164
msgctxt "input"
msgid "From Date"
msgstr "A partir de la fecha"
#: pkg/quote.go:169 pkg/expenses.go:437 pkg/invoices.go:169
#: pkg/quote.go:169 pkg/expenses.go:466 pkg/invoices.go:169
msgctxt "input"
msgid "To Date"
msgstr "Hasta la fecha"
@ -1062,8 +1063,8 @@ msgstr "presupuestos.zip"
msgid "quotations.ods"
msgstr "presupuestos.ods"
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:651
#: pkg/expenses.go:677 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/quote.go:634 pkg/quote.go:1176 pkg/quote.go:1184 pkg/expenses.go:680
#: pkg/expenses.go:706 pkg/invoices.go:677 pkg/invoices.go:1306
#: pkg/invoices.go:1314
msgid "Invalid action"
msgstr "Acción inválida."
@ -1218,70 +1219,70 @@ msgctxt "period option"
msgid "Previous year"
msgstr "Año anterior"
#: pkg/expenses.go:172
#: pkg/expenses.go:201
msgid "Select a contact."
msgstr "Escoged un contacto"
#: pkg/expenses.go:229 pkg/expenses.go:421
#: pkg/expenses.go:258 pkg/expenses.go:450
msgctxt "input"
msgid "Contact"
msgstr "Contacto"
#: pkg/expenses.go:235
#: pkg/expenses.go:264
msgctxt "input"
msgid "Invoice number"
msgstr "Número de factura"
#: pkg/expenses.go:240 pkg/invoices.go:735
#: pkg/expenses.go:269 pkg/invoices.go:735
msgctxt "input"
msgid "Invoice Date"
msgstr "Fecha de factura"
#: pkg/expenses.go:255
#: pkg/expenses.go:284
msgctxt "input"
msgid "Amount"
msgstr "Importe"
#: pkg/expenses.go:266 pkg/invoices.go:757
#: pkg/expenses.go:295 pkg/invoices.go:757
msgctxt "input"
msgid "File"
msgstr "Archivo"
#: pkg/expenses.go:272 pkg/expenses.go:446
#: pkg/expenses.go:301 pkg/expenses.go:475
msgctxt "input"
msgid "Expense Status"
msgstr "Estado del gasto"
#: pkg/expenses.go:312
#: pkg/expenses.go:341
msgid "Selected contact is not valid."
msgstr "Habéis escogido un contacto que no es válido."
#: pkg/expenses.go:313 pkg/invoices.go:808
#: pkg/expenses.go:342 pkg/invoices.go:808
msgid "Invoice date must be a valid date."
msgstr "La fecha de factura debe ser válida."
#: pkg/expenses.go:316
#: pkg/expenses.go:345
msgid "Amount can not be empty."
msgstr "No podéis dejar el importe en blanco."
#: pkg/expenses.go:317
#: pkg/expenses.go:346
msgid "Amount must be a number greater than zero."
msgstr "El importe tiene que ser un número mayor a cero."
#: pkg/expenses.go:319
#: pkg/expenses.go:348
msgid "Selected expense status is not valid."
msgstr "Habéis escogido un estado de gasto que no es válido."
#: pkg/expenses.go:422
#: pkg/expenses.go:451
msgid "All contacts"
msgstr "Todos los contactos"
#: pkg/expenses.go:427 pkg/invoices.go:159
#: pkg/expenses.go:456 pkg/invoices.go:159
msgctxt "input"
msgid "Invoice Number"
msgstr "Número de factura"
#: pkg/expenses.go:675
#: pkg/expenses.go:704
msgid "expenses.ods"
msgstr "gastos.ods"

View File

@ -67,7 +67,11 @@
<th>{{( pgettext "Invoice Number" "title" )}}</th>
<th>{{( pgettext "Status" "title" )}}</th>
<th>{{( pgettext "Tags" "title" )}}</th>
<th>{{( pgettext "Amount" "title" )}}</th>
<th class="numeric">{{( pgettext "Amount" "title" )}}</th>
{{ range $class := .TaxClasses -}}
<th class="numeric">{{ . }}</th>
{{ end -}}
<th class="numeric">{{( pgettext "Total" "title" )}}</th>
<th>{{( pgettext "Download" "title" )}}</th>
<th>{{( pgettext "Actions" "title" )}}</th>
</tr>
@ -113,6 +117,11 @@
{{- end }}
</td>
<td class="numeric">{{ .Amount | formatPrice }}</td>
{{ range $class := $.TaxClasses -}}
{{ $tax := index $expense.Taxes $class }}
<td class="numeric">{{ if $tax }}{{ $tax | formatPrice }}{{ end }}</td>
{{- end }}
<td class="numeric">{{ .Total | formatPrice }}</td>
<td class="invoice-download">
{{ if .OriginalFileName }}
<a href="{{ companyURI "/expenses/"}}{{ .Slug }}/download/{{.OriginalFileName}}"
@ -141,14 +150,14 @@
{{- end }}
{{ else }}
<tr>
<td colspan="7">{{( gettext "No expenses added yet." )}}</td>
<td colspan="{{ add 9 (len .TaxClasses) }}">{{( gettext "No expenses added yet." )}}</td>
</tr>
{{ end }}
</tbody>
{{ if .Expenses }}
<tfoot>
<tr>
<th scope="row" colspan="5">{{( gettext "Total" )}}</th>
<th scope="row" colspan="{{ add 6 (len .TaxClasses) }}">{{( gettext "Total" )}}</th>
<td class="numeric">{{ .TotalAmount|formatPrice }}</td>
<td colspan="2"></td>
</tr>