feat: added remaining after budget
This commit is contained in:
@@ -19,9 +19,8 @@ await api.downloadBudget(process.env.ACTUAL_ID, {
|
||||
password: process.env.ACTUAL_ENCRYPTION,
|
||||
});
|
||||
|
||||
|
||||
export async function getSchedules(select = '*') {
|
||||
export async function getSchedulesSQL(select = '*') {
|
||||
return (await api.runQuery(api.q('schedules').select(select))).data;
|
||||
}
|
||||
|
||||
export * from '@actual-app/api';
|
||||
export * from '@actual-app/api';
|
||||
|
||||
18
lib/format.js
Normal file
18
lib/format.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
const amountFormatter = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR' });
|
||||
export function formatAmount(amount) {
|
||||
return chalk.bold(amountFormatter.format(Math.abs(amount / 100)));
|
||||
}
|
||||
|
||||
export function formatSchedule(s, c) {
|
||||
const operator = s._amountOp === 'isapprox' ? '~ ' : '';
|
||||
let meta = formatAmount(s._amount);
|
||||
if (s._date.frequency) {
|
||||
meta += ` - ${s._date.frequency}`;
|
||||
}
|
||||
if (c?.name) {
|
||||
meta += ` - ${c.name}`;
|
||||
}
|
||||
return `${chalk.underline(s.name)} (${operator}${meta})`;
|
||||
}
|
||||
Reference in New Issue
Block a user