Skip to content

Commit

Permalink
ExactRepository: add functions to get budget data
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoKruijer committed Jul 9, 2021
1 parent b484a13 commit 5385bae
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
29 changes: 29 additions & 0 deletions repositories/ExactRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import type {
Account,
AccountClassification,
AccountClassificationMapping,
BudgetScenario,
BudgetScenarioValue,
DivisionResponse,
FinancialPeriod,
ODataDateTime,
Expand Down Expand Up @@ -85,6 +87,33 @@ export default class ExactRepository {
});
}

public getBudgetScenario(descriptionFilter = "", top = 25) {
const searchParams = new URLSearchParams({
$orderby: "Description asc",
});

return this.cleanJsonRequest<BudgetScenario>({
method: "GET",
resource: "budget/BudgetScenarios",
betaRoute: true,
filter: `startswith(Description, '${descriptionFilter}')`,
select: "ID, Code, Description, Division, FromYear, ToYear",
top: top + "",
searchParams,
});
}

public getBudgetScenarioValues(budget: ODataGuid) {
return this.cleanJsonRequest<BudgetScenarioValue>({
method: "GET",
resource: "budget/Budgets",
filter: `BudgetScenario eq guid'${budget}'`,
select:
"BudgetScenario, BudgetScenarioCode, BudgetScenarioDescription, AmountDC, ReportingYear, " +
"ReportingPeriod, GLAccount, GLAccountCode, GLAccountDescription",
});
}

public getAccounts(descriptionFilter: string, top = 25) {
const searchParams = new URLSearchParams({
$orderby: "Description asc",
Expand Down
19 changes: 19 additions & 0 deletions repositories/exact_models.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,22 @@ export interface RevenueListResponse {
Period: number;
Amount: number;
}

export interface BudgetScenario {
ID: ODataGuid;
Code: string;
Description: string;
Division: number;
FromYear: number;
ToYear: number;
}

export interface BudgetScenarioValue extends IAccount {
BudgetScenario: ODataGuid;
BudgetScenarioCode: string;
BudgetScenarioDescription: string;

AmountDC: number;
ReportingPeriod: number;
ReportingYear: number;
}

0 comments on commit 5385bae

Please sign in to comment.