Skip to content

Commit 779bc1d

Browse files
committed
Fix Profit and Loss Report param
The timeframe is not numeric like other reports, but a string "MONTH, QUARTER or YEAR).
1 parent 4d12441 commit 779bc1d

5 files changed

Lines changed: 19 additions & 11 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This is the official Java SDK for Xero's API. It supports accounting, fixed asse
44

55

66
## Migrating from version 1.0 to 2.0 of SDK
7-
We've made some big changes to our Java SDK with version 2.0.
7+
We've made some big changes to our Java SDK with version 2.0. All code examples in this README are for version 2.0. We've archived [code samples for version 1.0 here](https://github.com/XeroAPI/Xero-Java/tree/master/example).
88

99
2.0 implements requests and responses for accounting API endpoints using JSON only. Don't worry we won't be removing any of the existing methods for XML, but will mark them as deprecated in favor of JSON.
1010

@@ -72,7 +72,7 @@ For those using maven, add the dependency and repository to your pom.xml
7272
<dependency>
7373
<groupId>com.xero</groupId>
7474
<artifactId>xero-java-sdk</artifactId>
75-
<version>2.0.0</version>
75+
<version>2.0.1</version>
7676
</dependency>
7777

7878
<repositories>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.xero</groupId>
55
<artifactId>xero-java-sdk</artifactId>
66
<packaging>jar</packaging>
7-
<version>2.0.0</version>
7+
<version>2.0.1</version>
88
<name>Xero-Java SDK</name>
99
<url>http://maven.apache.org</url>
1010
<dependencies>

src/main/java/com/xero/api/JsonConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public String getAccessTokenUrl() {
131131

132132
@Override
133133
public String getUserAgent() {
134-
return USER_AGENT + " " + CONSUMER_KEY + " [Xero-Java-2.0.0]";
134+
return USER_AGENT + " " + CONSUMER_KEY + " [Xero-Java-2.0.1]";
135135
}
136136

137137
@Override

src/main/java/com/xero/api/client/AccountingApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6573,7 +6573,7 @@ public ReportWithRows getReportExecutiveSummary(String date) throws IOException
65736573
* @return ReportWithRows
65746574
* @throws IOException if an error occurs while attempting to invoke the API
65756575
**/
6576-
public ReportWithRows getReportProfitAndLoss(String fromDate, String toDate, BigDecimal periods, BigDecimal timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException {
6576+
public ReportWithRows getReportProfitAndLoss(String fromDate, String toDate, BigDecimal periods, String timeframe, String trackingCategoryID, String trackingCategoryID2, String trackingOptionID, String trackingOptionID2, Boolean standardLayout, Boolean paymentsOnly) throws IOException {
65776577
//, Map<String, String> params
65786578
try {
65796579
String strBody = null;

src/main/java/com/xero/example/RequestResourceServlet.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,18 +2215,21 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
22152215
System.out.println(e.getMessage());
22162216
}
22172217
} else if (object.equals("Reports")) {
2218+
22182219
/* REPORTS */
2220+
/*
22192221
// TenNinetyNine - US Only
22202222
String reportYear = null;
22212223
Reports reports = accountingApi.getReportTenNinetyNine(reportYear);
22222224
System.out.println(reports.toString());
2223-
2225+
*/
22242226
// AgedPayablesByContact
22252227
String date = null;
22262228
String fromDate = null;
22272229
String toDate = null;
22282230
BigDecimal periods = null;
22292231
BigDecimal timeframe = null;
2232+
String profitLossTimeframe = null;
22302233
String trackingOptionID1 = null;
22312234
String trackingOptionID2 = null;
22322235
boolean standardLayout = false;
@@ -2248,7 +2251,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
22482251
ReportWithRows reportBalanceSheet = accountingApi.getReportBalanceSheet(toDate, periods, timeframe, trackingOptionID1, trackingOptionID2, standardLayout, paymentsOnly);
22492252
messages.add("Get a Reports - Name:" + reportBalanceSheet.getReports().get(0).getReportName());
22502253

2251-
// reportBalanceSheet
2254+
// reportBankSummary
22522255
BigDecimal period = null;
22532256
ReportWithRows reportBankSummary = accountingApi.getReportBankSummary(toDate, period, timeframe);
22542257
messages.add("Get a Reports - Name:" + reportBankSummary.getReports().get(0).getReportName());
@@ -2262,12 +2265,17 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
22622265
messages.add("Get a Reports - Name:" + reportExecutiveSummary.getReports().get(0).getReportName());
22632266

22642267
// reportProfitandLoss
2265-
Map<String, String> reportParams = new HashMap<>();
2266-
addToMapIfNotNull(reportParams, "fromDate", "2018-07-01");
2267-
addToMapIfNotNull(reportParams, "toDate", "2018-09-01");
2268+
fromDate = "2018-07-01";
2269+
toDate = "2018-11-30";
22682270

2269-
ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(fromDate, toDate, periods, timeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
2271+
profitLossTimeframe = "MONTH";
2272+
ReportWithRows reportProfitLoss = accountingApi.getReportProfitAndLoss(fromDate, toDate, periods, profitLossTimeframe, trackingCategoryID, trackingCategoryID2, trackingOptionID, trackingOptionID2, standardLayout, paymentsOnly);
22702273
messages.add("Get a Reports - Name:" + reportProfitLoss.getReports().get(0).getReportName());
2274+
fromDate = null;
2275+
toDate = null;
2276+
2277+
System.out.println(reportProfitLoss.toString());
2278+
22712279

22722280
// reportTrialBalance
22732281
ReportWithRows reportTrialBalance = accountingApi.getReportTrialBalance(toDate, paymentsOnly);

0 commit comments

Comments
 (0)