fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-accounting] 20/36: added api for income statement
Date Mon, 22 Jan 2018 15:43:56 GMT
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-accounting.git

commit 22ea1d66b84e838a48a64bed40a13b0eddb06e40
Author: mgeiss <mgeiss@mifos.org>
AuthorDate: Mon Oct 9 19:01:47 2017 +0200

    added api for income statement
---
 .../accounting/api/v1/client/LedgerManager.java    |  9 +++
 .../accounting/api/v1/domain/IncomeStatement.java  | 80 ++++++++++++++++++++++
 .../api/v1/domain/IncomeStatementEntry.java        | 49 +++++++++++++
 .../api/v1/domain/IncomeStatementSection.java      | 74 ++++++++++++++++++++
 4 files changed, 212 insertions(+)

diff --git a/api/src/main/java/io/mifos/accounting/api/v1/client/LedgerManager.java b/api/src/main/java/io/mifos/accounting/api/v1/client/LedgerManager.java
index 8a9177e..7959d19 100644
--- a/api/src/main/java/io/mifos/accounting/api/v1/client/LedgerManager.java
+++ b/api/src/main/java/io/mifos/accounting/api/v1/client/LedgerManager.java
@@ -21,6 +21,7 @@ import io.mifos.accounting.api.v1.domain.AccountEntry;
 import io.mifos.accounting.api.v1.domain.AccountEntryPage;
 import io.mifos.accounting.api.v1.domain.AccountPage;
 import io.mifos.accounting.api.v1.domain.ChartOfAccountEntry;
+import io.mifos.accounting.api.v1.domain.IncomeStatement;
 import io.mifos.accounting.api.v1.domain.JournalEntry;
 import io.mifos.accounting.api.v1.domain.Ledger;
 import io.mifos.accounting.api.v1.domain.LedgerPage;
@@ -398,4 +399,12 @@ public interface LedgerManager {
       @ThrowsException(status = HttpStatus.NOT_FOUND, exception = AccountNotFoundException.class)
   })
   List<AccountCommand> fetchActions(@PathVariable(value = "identifier") final String
identifier);
+
+  @RequestMapping(
+      value = "/incomestatement",
+      method = RequestMethod.GET,
+      produces = {MediaType.ALL_VALUE},
+      consumes = {MediaType.APPLICATION_JSON_VALUE}
+  )
+  IncomeStatement getIncomeStatement();
 }
diff --git a/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatement.java b/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatement.java
new file mode 100644
index 0000000..a96c9ca
--- /dev/null
+++ b/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatement.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.accounting.api.v1.domain;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.List;
+
+public class IncomeStatement {
+
+  @NotEmpty
+  private String date;
+  @NotEmpty
+  private List<IncomeStatementSection> incomeStatementSections;
+  @NotNull
+  private BigDecimal grossProfit;
+  @NotNull
+  private BigDecimal totalExpenses;
+  @NotNull
+  private BigDecimal netIncome;
+
+  public IncomeStatement() {
+    super();
+  }
+
+  public String getDate() {
+    return this.date;
+  }
+
+  public void setDate(final String date) {
+    this.date = date;
+  }
+
+  public List<IncomeStatementSection> getIncomeStatementSections() {
+    return this.incomeStatementSections;
+  }
+
+  public void setIncomeStatementSections(final List<IncomeStatementSection> incomeStatementSections)
{
+    this.incomeStatementSections = incomeStatementSections;
+  }
+
+  public BigDecimal getGrossProfit() {
+    return this.grossProfit;
+  }
+
+  public void setGrossProfit(final BigDecimal grossProfit) {
+    this.grossProfit = grossProfit;
+  }
+
+  public BigDecimal getTotalExpenses() {
+    return this.totalExpenses;
+  }
+
+  public void setTotalExpenses(final BigDecimal totalExpenses) {
+    this.totalExpenses = totalExpenses;
+  }
+
+  public BigDecimal getNetIncome() {
+    return this.netIncome;
+  }
+
+  public void setNetIncome(final BigDecimal netIncome) {
+    this.netIncome = netIncome;
+  }
+}
diff --git a/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatementEntry.java
b/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatementEntry.java
new file mode 100644
index 0000000..6ee34dc
--- /dev/null
+++ b/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatementEntry.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.accounting.api.v1.domain;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+public class IncomeStatementEntry {
+
+  @NotEmpty
+  private String description;
+  @NotNull
+  private BigDecimal value;
+
+  public IncomeStatementEntry() {
+    super();
+  }
+
+  public String getDescription() {
+    return this.description;
+  }
+
+  public void setDescription(final String description) {
+    this.description = description;
+  }
+
+  public BigDecimal getValue() {
+    return this.value;
+  }
+
+  public void setValue(final BigDecimal value) {
+    this.value = value;
+  }
+}
diff --git a/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatementSection.java
b/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatementSection.java
new file mode 100644
index 0000000..c1ba67d
--- /dev/null
+++ b/api/src/main/java/io/mifos/accounting/api/v1/domain/IncomeStatementSection.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.mifos.accounting.api.v1.domain;
+
+import org.hibernate.validator.constraints.NotEmpty;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.util.List;
+
+public class IncomeStatementSection {
+
+  enum Type {
+    INCOME,
+    EXPENSES
+  }
+
+  @NotEmpty
+  private Type type;
+  private String description;
+  @NotEmpty
+  private List<IncomeStatementEntry> incomeStatementEntries;
+  @NotNull
+  private BigDecimal subtotal;
+
+  public IncomeStatementSection() {
+    super();
+  }
+
+  public String getType() {
+    return this.type.name();
+  }
+
+  public void setType(final String type) {
+    this.type = Type.valueOf(type);
+  }
+
+  public String getDescription() {
+    return this.description;
+  }
+
+  public void setDescription(final String description) {
+    this.description = description;
+  }
+
+  public List<IncomeStatementEntry> getIncomeStatementEntries() {
+    return this.incomeStatementEntries;
+  }
+
+  public void setIncomeStatementEntries(final List<IncomeStatementEntry> incomeStatementEntries)
{
+    this.incomeStatementEntries = incomeStatementEntries;
+  }
+
+  public BigDecimal getSubtotal() {
+    return this.subtotal;
+  }
+
+  public void setSubtotal(final BigDecimal subtotal) {
+    this.subtotal = subtotal;
+  }
+}

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

Mime
View raw message