mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-09 23:06:01 +00:00
feat(relatorios): refina analise de parcelas
This commit is contained in:
@@ -192,6 +192,22 @@ export async function fetchInstallmentAnalysis(
|
||||
(i) => !i.isSettled,
|
||||
);
|
||||
return hasUnpaidInstallments;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
const progressA =
|
||||
a.trackedInstallments > 0
|
||||
? a.paidInstallments / a.trackedInstallments
|
||||
: 0;
|
||||
const progressB =
|
||||
b.trackedInstallments > 0
|
||||
? b.paidInstallments / b.trackedInstallments
|
||||
: 0;
|
||||
|
||||
if (progressA !== progressB) {
|
||||
return progressB - progressA;
|
||||
}
|
||||
|
||||
return a.firstPurchaseDate.getTime() - b.firstPurchaseDate.getTime();
|
||||
});
|
||||
|
||||
// Calcular totais
|
||||
|
||||
Reference in New Issue
Block a user