feat: categoria is_tax exclui impostos do denominador do savings_pct
savings_pct = (receita - despesas) / (receita - impostos). Toggle IMPOSTO no CRUD de categorias; badge dourado na lista. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
@@ -90,6 +90,19 @@ func (r *DashboardRepository) MonthlyEvolution(ctx context.Context, month string
|
||||
return out, rows.Err()
|
||||
}
|
||||
|
||||
func (r *DashboardRepository) TotalTaxes(ctx context.Context, month string) (float64, error) {
|
||||
var total float64
|
||||
err := r.pool.QueryRow(ctx, `
|
||||
SELECT COALESCE(SUM(t.amount), 0)
|
||||
FROM transactions t
|
||||
JOIN categories c ON c.id = t.category_id
|
||||
WHERE to_char(t.date, 'YYYY-MM') = $1
|
||||
AND t.type = 'expense'
|
||||
AND c.is_tax = TRUE
|
||||
`, month).Scan(&total)
|
||||
return total, err
|
||||
}
|
||||
|
||||
func (r *DashboardRepository) RecentTransactions(ctx context.Context, month string) ([]model.RecentTransaction, error) {
|
||||
rows, err := r.pool.Query(ctx, `
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user