XeroAPI / xero-php-oauth2

Xero PHP SDK for oAuth 2 generated from Xero API OpenAPI Spec 3.0
MIT License
92 stars 66 forks source link

Report Profit and Loss API returning different values #250

Closed CaptureKervin closed 2 years ago

CaptureKervin commented 3 years ago

Good day,

I'm calling the getReportProfitandLoss API to check the necessary income and revenue. But when I compare what is being returned versus what is being shown on my Profit and Loss report on Xero site, it returns different data.

This is how I called the API in PHP/Laravel: $profits = json_decode($apiInstance->getReportProfitandLoss($xeroTenantId, $startDate, $endDate, 11, 'MONTH', true), true);

Even if I stated the timeframe as "Month", it doesn't look like it's returning the monthly reporting data.

Thanks in advance!

CaptureKervin commented 3 years ago

Good day Xero,

Any updates on this? To clarify our issue, the API is returning values per month which is an accumulation of the 12 month period per month. We were expecting the exact monthly values instead of the annual-accumulation of data.

Hoping for your immediate response. Thanks!

wobinb commented 2 years ago

Hi Kevin

If you are looking for a 12 month profit and loss split out by month eg. Jan - Dec you would need to use the following values: Start Date = 1st day of the final month eg. 01/12/2021 End Date = last day of the final month eg. 31/12/2021 Periods = 11 Timeframe = MONTH

In order to compare it with the reports through the front-end you'll need to ensure that you are looking at the classic version of the report - not the 'New' verison.

It is also worth noting that this won't work where the final month only has 30 days, as only 30 days of the comparison months will be included. We generally suggest running it for two 31 day months and combining the results.