diff --git a/pkg/payments.go b/pkg/payments.go index 950cdb5..d0e064f 100644 --- a/pkg/payments.go +++ b/pkg/payments.go @@ -38,6 +38,8 @@ type PaymentEntry struct { Slug string PaymentDate time.Time Description string + ExpenseSlug string + InvoiceNumber string Total string OriginalFileName string Tags []string @@ -56,11 +58,15 @@ func mustCollectPaymentEntries(ctx context.Context, conn *Conn, company *Company , payment.payment_status , psi18n.name , coalesce(attachment.original_filename, '') + , coalesce(expense.slug::text, '') + , coalesce(expense.invoice_number, '') from payment join payment_status_i18n psi18n on payment.payment_status = psi18n.payment_status and psi18n.lang_tag = $1 join currency using (currency_code) left join payment_attachment as attachment using (payment_id) - where company_id = $2 + left join expense_payment using (payment_id) + left join expense using (expense_id) + where payment.company_id = $2 order by payment_date desc, total desc `, locale.Language, company.Id) defer rows.Close() @@ -68,7 +74,7 @@ func mustCollectPaymentEntries(ctx context.Context, conn *Conn, company *Company var entries []*PaymentEntry for rows.Next() { entry := &PaymentEntry{} - if err := rows.Scan(&entry.ID, &entry.Slug, &entry.PaymentDate, &entry.Description, &entry.Total, &entry.Tags, &entry.Status, &entry.StatusLabel, &entry.OriginalFileName); err != nil { + if err := rows.Scan(&entry.ID, &entry.Slug, &entry.PaymentDate, &entry.Description, &entry.Total, &entry.Tags, &entry.Status, &entry.StatusLabel, &entry.OriginalFileName, &entry.ExpenseSlug, &entry.InvoiceNumber); err != nil { panic(err) } entries = append(entries, entry) diff --git a/po/ca.po b/po/ca.po index 2c679cc..ea09fb6 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: numerus\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-08-14 04:02+0200\n" +"POT-Creation-Date: 2024-08-15 03:58+0200\n" "PO-Revision-Date: 2023-01-18 17:08+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Catalan \n" @@ -116,7 +116,7 @@ msgstr "Subtotal" #: 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:46 web/template/expenses/index.gohtml:74 -#: web/template/expenses/edit.gohtml:48 web/template/payments/index.gohtml:29 +#: web/template/expenses/edit.gohtml:48 web/template/payments/index.gohtml:30 msgctxt "title" msgid "Total" msgstr "Total" @@ -193,14 +193,14 @@ msgid "Customer" msgstr "Client" #: web/template/invoices/index.gohtml:70 web/template/quotes/index.gohtml:70 -#: web/template/expenses/index.gohtml:68 web/template/payments/index.gohtml:27 +#: web/template/expenses/index.gohtml:68 web/template/payments/index.gohtml:28 msgctxt "title" msgid "Status" msgstr "Estat" #: web/template/invoices/index.gohtml:71 web/template/quotes/index.gohtml:71 #: web/template/contacts/index.gohtml:50 web/template/expenses/index.gohtml:69 -#: web/template/products/index.gohtml:46 web/template/payments/index.gohtml:28 +#: web/template/products/index.gohtml:46 web/template/payments/index.gohtml:29 msgctxt "title" msgid "Tags" msgstr "Etiquetes" @@ -212,7 +212,7 @@ msgid "Amount" msgstr "Import" #: web/template/invoices/index.gohtml:73 web/template/quotes/index.gohtml:73 -#: web/template/expenses/index.gohtml:75 web/template/payments/index.gohtml:30 +#: web/template/expenses/index.gohtml:75 web/template/payments/index.gohtml:31 msgctxt "title" msgid "Download" msgstr "Descàrrega" @@ -220,7 +220,7 @@ 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:76 #: web/template/company/switch.gohtml:23 web/template/products/index.gohtml:48 -#: web/template/payments/index.gohtml:31 +#: web/template/payments/index.gohtml:32 msgctxt "title" msgid "Actions" msgstr "Accions" @@ -242,7 +242,7 @@ msgstr "Accions per la factura %s" #: web/template/invoices/index.gohtml:139 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:121 -#: web/template/products/index.gohtml:78 web/template/payments/index.gohtml:71 +#: web/template/products/index.gohtml:78 web/template/payments/index.gohtml:77 msgctxt "action" msgid "Edit" msgstr "Edita" @@ -794,20 +794,25 @@ msgctxt "title" msgid "Description" msgstr "Descripció" -#: web/template/payments/index.gohtml:36 +#: web/template/payments/index.gohtml:27 +msgctxt "title" +msgid "Document" +msgstr "Document" + +#: web/template/payments/index.gohtml:37 msgid "Are you sure you wish to delete this payment?" msgstr "Esteu segur de voler esborrar aquest pagament?" -#: web/template/payments/index.gohtml:63 +#: web/template/payments/index.gohtml:69 msgid "Actions for payment %s" msgstr "Accions pel pagament %s" -#: web/template/payments/index.gohtml:82 +#: web/template/payments/index.gohtml:88 msgctxt "action" msgid "Remove" msgstr "Esborra" -#: web/template/payments/index.gohtml:92 +#: web/template/payments/index.gohtml:98 msgid "No payments added yet." msgstr "No hi ha cap pagament." @@ -882,14 +887,14 @@ msgstr "No podeu deixar la contrasenya en blanc." msgid "Invalid user or password." msgstr "Nom d’usuari o contrasenya incorrectes." -#: pkg/products.go:172 pkg/products.go:276 pkg/quote.go:901 pkg/accounts.go:138 +#: pkg/products.go:172 pkg/products.go:276 pkg/quote.go:901 pkg/accounts.go:140 #: pkg/invoices.go:1147 pkg/contacts.go:149 pkg/contacts.go:262 msgctxt "input" msgid "Name" msgstr "Nom" #: pkg/products.go:177 pkg/products.go:303 pkg/quote.go:174 pkg/quote.go:708 -#: pkg/payments.go:154 pkg/expenses.go:335 pkg/expenses.go:485 +#: pkg/payments.go:162 pkg/expenses.go:335 pkg/expenses.go:485 #: pkg/invoices.go:177 pkg/invoices.go:877 pkg/invoices.go:1462 #: pkg/contacts.go:154 pkg/contacts.go:362 msgctxt "input" @@ -924,7 +929,7 @@ msgstr "Qualsevol" 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." -#: pkg/products.go:282 pkg/quote.go:915 pkg/payments.go:121 +#: pkg/products.go:282 pkg/quote.go:915 pkg/payments.go:129 #: pkg/invoices.go:1161 msgctxt "input" msgid "Description" @@ -1339,103 +1344,103 @@ msgstr "La confirmació no és igual a la contrasenya." msgid "Selected language is not valid." msgstr "Heu seleccionat un idioma que no és vàlid." -#: pkg/payments.go:127 pkg/expenses.go:304 pkg/invoices.go:866 +#: pkg/payments.go:135 pkg/expenses.go:304 pkg/invoices.go:866 msgctxt "input" msgid "Invoice Date" msgstr "Data de factura" -#: pkg/payments.go:133 +#: pkg/payments.go:141 msgctxt "input" msgid "Account" msgstr "Compte" -#: pkg/payments.go:139 pkg/expenses.go:319 +#: pkg/payments.go:147 pkg/expenses.go:319 msgctxt "input" msgid "Amount" msgstr "Import" -#: pkg/payments.go:149 pkg/expenses.go:330 pkg/invoices.go:888 +#: pkg/payments.go:157 pkg/expenses.go:330 pkg/invoices.go:888 msgctxt "input" msgid "File" msgstr "Fitxer" -#: pkg/payments.go:161 +#: pkg/payments.go:169 msgid "Select an account." msgstr "Escolliu un compte." -#: pkg/payments.go:210 +#: pkg/payments.go:218 msgid "Description can not be empty." msgstr "No podeu deixar la descripció en blanc." -#: pkg/payments.go:211 +#: pkg/payments.go:219 msgid "Selected payment account is not valid." msgstr "Heu seleccionat un compte de pagament que no és vàlid." -#: pkg/payments.go:212 +#: pkg/payments.go:220 msgid "Payment date must be a valid date." msgstr "La data de pagament ha de ser vàlida." -#: pkg/payments.go:213 pkg/expenses.go:372 +#: pkg/payments.go:221 pkg/expenses.go:372 msgid "Amount can not be empty." msgstr "No podeu deixar l’import en blanc." -#: pkg/payments.go:214 pkg/expenses.go:373 +#: pkg/payments.go:222 pkg/expenses.go:373 msgid "Amount must be a number greater than zero." msgstr "L’import ha de ser un número major a zero." -#: pkg/accounts.go:129 +#: pkg/accounts.go:131 msgctxt "input" msgid "Type" msgstr "Tipus" -#: pkg/accounts.go:144 pkg/contacts.go:352 +#: pkg/accounts.go:146 pkg/contacts.go:352 msgctxt "input" msgid "IBAN" msgstr "IBAN" -#: pkg/accounts.go:150 +#: pkg/accounts.go:152 msgctxt "input" msgid "Card’s last four digits" msgstr "Els quatre darrers dígits de la targeta" -#: pkg/accounts.go:161 +#: pkg/accounts.go:163 msgctxt "input" msgid "Expiration date" msgstr "Data de caducitat" -#: pkg/accounts.go:227 +#: pkg/accounts.go:229 msgid "Selected payment account type is not valid." msgstr "Heu seleccionat un tipus de compte de pagament que no és vàlid." -#: pkg/accounts.go:230 +#: pkg/accounts.go:232 msgid "IBAN can not be empty." msgstr "No podeu deixar l’IBAN en blanc." -#: pkg/accounts.go:231 +#: pkg/accounts.go:233 msgid "This value is not a valid IBAN." msgstr "Aquest valor no és un IBAN vàlid." -#: pkg/accounts.go:234 +#: pkg/accounts.go:236 msgid "Last four digits can not be empty." msgstr "No podeu deixar el quatre darrers dígits en blanc." -#: pkg/accounts.go:235 +#: pkg/accounts.go:237 msgid "You must enter the card’s last four digits" msgstr "Heu d’entrar els quatre darrers dígits de la targeta" -#: pkg/accounts.go:236 +#: pkg/accounts.go:238 msgid "Last four digits must be a number." msgstr "El quatre darrera dígits han de ser un número." -#: pkg/accounts.go:239 +#: pkg/accounts.go:241 msgid "Expiration date can not be empty." msgstr "No podeu deixar la data de pagament en blanc." -#: pkg/accounts.go:241 +#: pkg/accounts.go:243 msgid "Expiration date should be a valid date in format MM/YY (e.g., 08/24)." msgstr "La data de caducitat has de ser vàlida i en format MM/AA (p. ex., 08/24)." -#: pkg/accounts.go:245 +#: pkg/accounts.go:247 msgid "Payment account name can not be empty." msgstr "No podeu deixar el nom del compte de pagament en blanc." diff --git a/po/es.po b/po/es.po index b763b64..e2835b0 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: numerus\n" "Report-Msgid-Bugs-To: jordi@tandem.blog\n" -"POT-Creation-Date: 2024-08-14 04:02+0200\n" +"POT-Creation-Date: 2024-08-15 03:58+0200\n" "PO-Revision-Date: 2023-01-18 17:45+0100\n" "Last-Translator: jordi fita mas \n" "Language-Team: Spanish \n" @@ -116,7 +116,7 @@ msgstr "Subtotal" #: 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:46 web/template/expenses/index.gohtml:74 -#: web/template/expenses/edit.gohtml:48 web/template/payments/index.gohtml:29 +#: web/template/expenses/edit.gohtml:48 web/template/payments/index.gohtml:30 msgctxt "title" msgid "Total" msgstr "Total" @@ -193,14 +193,14 @@ msgid "Customer" msgstr "Cliente" #: web/template/invoices/index.gohtml:70 web/template/quotes/index.gohtml:70 -#: web/template/expenses/index.gohtml:68 web/template/payments/index.gohtml:27 +#: web/template/expenses/index.gohtml:68 web/template/payments/index.gohtml:28 msgctxt "title" msgid "Status" msgstr "Estado" #: web/template/invoices/index.gohtml:71 web/template/quotes/index.gohtml:71 #: web/template/contacts/index.gohtml:50 web/template/expenses/index.gohtml:69 -#: web/template/products/index.gohtml:46 web/template/payments/index.gohtml:28 +#: web/template/products/index.gohtml:46 web/template/payments/index.gohtml:29 msgctxt "title" msgid "Tags" msgstr "Etiquetes" @@ -212,7 +212,7 @@ msgid "Amount" msgstr "Importe" #: web/template/invoices/index.gohtml:73 web/template/quotes/index.gohtml:73 -#: web/template/expenses/index.gohtml:75 web/template/payments/index.gohtml:30 +#: web/template/expenses/index.gohtml:75 web/template/payments/index.gohtml:31 msgctxt "title" msgid "Download" msgstr "Descargar" @@ -220,7 +220,7 @@ 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:76 #: web/template/company/switch.gohtml:23 web/template/products/index.gohtml:48 -#: web/template/payments/index.gohtml:31 +#: web/template/payments/index.gohtml:32 msgctxt "title" msgid "Actions" msgstr "Acciones" @@ -242,7 +242,7 @@ msgstr "Acciones para la factura %s" #: web/template/invoices/index.gohtml:139 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:121 -#: web/template/products/index.gohtml:78 web/template/payments/index.gohtml:71 +#: web/template/products/index.gohtml:78 web/template/payments/index.gohtml:77 msgctxt "action" msgid "Edit" msgstr "Editar" @@ -794,20 +794,25 @@ msgctxt "title" msgid "Description" msgstr "Descripción" -#: web/template/payments/index.gohtml:36 +#: web/template/payments/index.gohtml:27 +msgctxt "title" +msgid "Document" +msgstr "Documento" + +#: web/template/payments/index.gohtml:37 msgid "Are you sure you wish to delete this payment?" msgstr "¿Estáis seguro de querer borrar este pago?" -#: web/template/payments/index.gohtml:63 +#: web/template/payments/index.gohtml:69 msgid "Actions for payment %s" msgstr "Acciones para el pago %s" -#: web/template/payments/index.gohtml:82 +#: web/template/payments/index.gohtml:88 msgctxt "action" msgid "Remove" msgstr "Borrar" -#: web/template/payments/index.gohtml:92 +#: web/template/payments/index.gohtml:98 msgid "No payments added yet." msgstr "No hay pagos." @@ -882,14 +887,14 @@ msgstr "No podéis dejar la contraseña en blanco." msgid "Invalid user or password." msgstr "Nombre de usuario o contraseña inválido." -#: pkg/products.go:172 pkg/products.go:276 pkg/quote.go:901 pkg/accounts.go:138 +#: pkg/products.go:172 pkg/products.go:276 pkg/quote.go:901 pkg/accounts.go:140 #: pkg/invoices.go:1147 pkg/contacts.go:149 pkg/contacts.go:262 msgctxt "input" msgid "Name" msgstr "Nombre" #: pkg/products.go:177 pkg/products.go:303 pkg/quote.go:174 pkg/quote.go:708 -#: pkg/payments.go:154 pkg/expenses.go:335 pkg/expenses.go:485 +#: pkg/payments.go:162 pkg/expenses.go:335 pkg/expenses.go:485 #: pkg/invoices.go:177 pkg/invoices.go:877 pkg/invoices.go:1462 #: pkg/contacts.go:154 pkg/contacts.go:362 msgctxt "input" @@ -924,7 +929,7 @@ msgstr "Cualquiera" msgid "Invoices must have at least one of the specified labels." msgstr "Las facturas deben tener como mínimo una de las etiquetas." -#: pkg/products.go:282 pkg/quote.go:915 pkg/payments.go:121 +#: pkg/products.go:282 pkg/quote.go:915 pkg/payments.go:129 #: pkg/invoices.go:1161 msgctxt "input" msgid "Description" @@ -1339,103 +1344,103 @@ msgstr "La confirmación no corresponde con la contraseña." msgid "Selected language is not valid." msgstr "Habéis escogido un idioma que no es válido." -#: pkg/payments.go:127 pkg/expenses.go:304 pkg/invoices.go:866 +#: pkg/payments.go:135 pkg/expenses.go:304 pkg/invoices.go:866 msgctxt "input" msgid "Invoice Date" msgstr "Fecha de factura" -#: pkg/payments.go:133 +#: pkg/payments.go:141 msgctxt "input" msgid "Account" msgstr "Cuenta" -#: pkg/payments.go:139 pkg/expenses.go:319 +#: pkg/payments.go:147 pkg/expenses.go:319 msgctxt "input" msgid "Amount" msgstr "Importe" -#: pkg/payments.go:149 pkg/expenses.go:330 pkg/invoices.go:888 +#: pkg/payments.go:157 pkg/expenses.go:330 pkg/invoices.go:888 msgctxt "input" msgid "File" msgstr "Archivo" -#: pkg/payments.go:161 +#: pkg/payments.go:169 msgid "Select an account." msgstr "Escoged una cuenta." -#: pkg/payments.go:210 +#: pkg/payments.go:218 msgid "Description can not be empty." msgstr "No podéis dejar la descripción en blanco." -#: pkg/payments.go:211 +#: pkg/payments.go:219 msgid "Selected payment account is not valid." msgstr "Habéis escogido una cuenta de pago que no es válida." -#: pkg/payments.go:212 +#: pkg/payments.go:220 msgid "Payment date must be a valid date." msgstr "La fecha de pago debe ser válida." -#: pkg/payments.go:213 pkg/expenses.go:372 +#: pkg/payments.go:221 pkg/expenses.go:372 msgid "Amount can not be empty." msgstr "No podéis dejar el importe en blanco." -#: pkg/payments.go:214 pkg/expenses.go:373 +#: pkg/payments.go:222 pkg/expenses.go:373 msgid "Amount must be a number greater than zero." msgstr "El importe tiene que ser un número mayor a cero." -#: pkg/accounts.go:129 +#: pkg/accounts.go:131 msgctxt "input" msgid "Type" msgstr "Tipo" -#: pkg/accounts.go:144 pkg/contacts.go:352 +#: pkg/accounts.go:146 pkg/contacts.go:352 msgctxt "input" msgid "IBAN" msgstr "IBAN" -#: pkg/accounts.go:150 +#: pkg/accounts.go:152 msgctxt "input" msgid "Card’s last four digits" msgstr "Últimos cuatro dígitos de la tarjeta" -#: pkg/accounts.go:161 +#: pkg/accounts.go:163 msgctxt "input" msgid "Expiration date" msgstr "Fecha de caducidad" -#: pkg/accounts.go:227 +#: pkg/accounts.go:229 msgid "Selected payment account type is not valid." msgstr "Habéis escogido un tipo de cuenta de pago que no es válido." -#: pkg/accounts.go:230 +#: pkg/accounts.go:232 msgid "IBAN can not be empty." msgstr "No podéis dejar el IBAN en blanco." -#: pkg/accounts.go:231 +#: pkg/accounts.go:233 msgid "This value is not a valid IBAN." msgstr "Este valor no es un IBAN válido." -#: pkg/accounts.go:234 +#: pkg/accounts.go:236 msgid "Last four digits can not be empty." msgstr "No podéis dejar los cuatro últimos dígitos en blanco." -#: pkg/accounts.go:235 +#: pkg/accounts.go:237 msgid "You must enter the card’s last four digits" msgstr "Debéis entrar los cuatro últimos dígitos de la tarjeta" -#: pkg/accounts.go:236 +#: pkg/accounts.go:238 msgid "Last four digits must be a number." msgstr "Los cuatro últimos dígitos tienen que ser un número." -#: pkg/accounts.go:239 +#: pkg/accounts.go:241 msgid "Expiration date can not be empty." msgstr "No podéis dejar la fecha de caducidad en blanco." -#: pkg/accounts.go:241 +#: pkg/accounts.go:243 msgid "Expiration date should be a valid date in format MM/YY (e.g., 08/24)." msgstr "La fecha de caducidad tiene que ser válida y en formato MM/AA (p. ej., 08/24)." -#: pkg/accounts.go:245 +#: pkg/accounts.go:247 msgid "Payment account name can not be empty." msgstr "No podéis dejar el nombre de la cuenta de pago en blanco." diff --git a/web/template/payments/index.gohtml b/web/template/payments/index.gohtml index da571cd..de3cbea 100644 --- a/web/template/payments/index.gohtml +++ b/web/template/payments/index.gohtml @@ -24,6 +24,7 @@ {{( pgettext "Payment Date" "title" )}} {{( pgettext "Description" "title" )}} + {{( pgettext "Document" "title" )}} {{( pgettext "Status" "title" )}} {{( pgettext "Tags" "title" )}} {{( pgettext "Total" "title" )}} @@ -38,6 +39,11 @@ {{ .PaymentDate|formatDate }} {{ .Description }} + + {{- if .InvoiceNumber -}} + {{ .InvoiceNumber }} + {{- end -}} + {{ .StatusLabel }} - {{( gettext "No payments added yet." )}} + {{( gettext "No payments added yet." )}} {{ end }}