Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/main/resources/reports/invoice_credits_daily/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Daily Invoice Credits Report

Total of invoice credits per tenant, per currency and per day.

So if there is an unpaid invoice for `$20` on `2025-09-22`, and an account credit is added for `$100` on the same day, there is a invoice credit of `$80` which will be shown on this report. If however, a new charge of `$200` is created later on on the same day, the `$80` credit is consumed so the total credit displayed by the report for `2025-09-22` is now `$0`.

The snapshot view is: [v_report_invoice_item_credits_daily](v_report_invoice_item_credits_daily.ddl)

## Timeline configuration

```
curl -v \
-X POST \
-u admin:password \
-H "X-Killbill-ApiKey:bob" \
-H "X-Killbill-ApiSecret:lazar" \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_daily_invoice_credits",
"reportType": "TIMELINE",
"reportPrettyName": "Invoice Credits Daily",
"sourceTableName": "report_invoice_credits_daily",
"refreshProcedureName": "refresh_report_invoice_credits_daily",
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Sample Data

| Tenant Record Id | Currency | Day | Count |
|------------------|----------|------------|----------|
| 1 | USD | 2025-05-05 | 0.0000 |
| 1 | USD | 2025-09-19 | 80.0000 |
| 22 | USD | 2025-09-19 | 125.0000 |
| 22 | EUR | 2025-09-22 | 45.0000 |
| 22 | USD | 2025-09-18 | -10.0000 |

This means that on `2025-09-19`, there was a total invoice credit of `$80` for the tenant_record_id=1.


## Report UI:

![invoice-credits-daily.png](invoice-credits-daily.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create table report_invoice_credits_daily as select * from v_report_invoice_credits_daily limit 0;

drop procedure if exists refresh_report_invoice_credits_daily;
DELIMITER //
CREATE PROCEDURE refresh_report_invoice_credits_daily()
BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
delete from report_invoice_credits_daily;
insert into report_invoice_credits_daily select * from v_report_invoice_credits_daily;
COMMIT;

END;
//
DELIMITER ;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
create or replace view v_report_invoice_item_credits_daily as
create or replace view v_report_invoice_credits_daily as
select
aic.tenant_record_id
, aic.currency
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Daily Invoice Item Adjustments report

Total of invoice item adjustments per tenant, per currency and per day.

So if there is an invoice for `$100` created on `2025-09-21` and the invoice is adjusted for `$20`, this report will show a value of `-20` for the date `2025-09-21` for the particular tenant. If there are multiple invoice item adjustments for the tenant on the same day, they will be added up.

The snapshot view is: [v_report_invoice_item_adjustments_daily](v_report_invoice_item_adjustments_daily.ddl)

## Timeline configuration

```
curl -v \
-X POST \
-u admin:password \
-H "X-Killbill-ApiKey:bob" \
-H "X-Killbill-ApiSecret:lazar" \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_daily_invoice_item_adjustments",
"reportType": "TIMELINE",
"reportPrettyName": "Invoice Item Adjustments Daily",
"sourceTableName": "report_invoice_item_adjustments_daily",
"refreshProcedureName": "refresh_report_invoice_item_adjustments_daily",
"refreshFrequency": "DAILY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Sample Data

| Tenant Record Id | Currency | Date | Count |
|------------------|----------|------------|-----------|
| 1 | EUR | 2025-08-28 | -10.0000 |
| 1 | USD | 2025-08-29 | |
| 1 | EUR | 2025-08-29 | -50.0000 |
| 1 | EUR | 2025-09-01 | -16.0000 |
| 1 | USD | 2025-09-16 | |
| 1 | EUR | 2025-09-02 | -19.9500 |
| 5 | USD | 2025-09-05 | -109.9500 |
| 1 | USD | 2025-09-19 | -19.3100 |
| 489 | USD | 2025-09-19 | -10.0000 |

This means that on the date `2025-08-28`, the tenant with record id=1 had a total invoice adjustments of EUR 10.

## Report UI:

![invoice_item_adjustments_daily.png](invoice_item_adjustments_daily.png)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create table report_invoice_item_adjustments_daily as select * from v_report_invoice_item_adjustments_daily limit 0;

drop procedure if exists refresh_report_invoice_item_adjustments_daily;
DELIMITER //
CREATE PROCEDURE refresh_report_invoice_item_adjustments_daily()
BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
delete from report_invoice_item_adjustments_daily;
insert into report_invoice_item_adjustments_daily select * from v_report_invoice_item_adjustments_daily;
COMMIT;

END;
//
DELIMITER ;
44 changes: 44 additions & 0 deletions src/main/resources/reports/overdue-states-count-daily/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Daily Overdue Count Report

Count of overdue states per tenant and per day.

The snapshot view is: [v_report_overdue_states_count_daily](v_report_overdue_states_count_daily.ddl)

## Timeline configuration

```
curl -v \
-X POST \
-u admin:password \
-H "X-Killbill-ApiKey:bob" \
-H "X-Killbill-ApiSecret:lazar" \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_overdue_states_count_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily Overdue Count",
"sourceTableName": "report_overdue_states_count_daily",
"refreshProcedureName": "refresh_report_overdue_states_count_daily",
"refreshFrequency": "HOURLY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Sample Data

| Tenant Record Id | State | Day | Count |
|------------------|--------------|------------|-------|
| 1 | BLOCKED | 2025-09-15 | 5 |
| 1 | BLOCKED | 2025-09-16 | 5 |
| 22 | BLOCKED | 2025-09-17 | 6 |
| 22 | CANCELLATION | 2025-09-18 | 3 |
| 1 | BLOCKED | 2025-09-18 | 1 |
| 23 | BLOCKED | 2025-09-19 | 7 |
| 45 | CANCELLATION | 2025-09-19 | 5 |

This means that on `2025-09-15`, 5 accounts were in `BLOCKED` overdue state for the tenant_record_id=1.

## Report UI:

![overdue-states-count-daily.png](overdue-states-count-daily.png)



Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create table report_overdue_states_count_daily as select * from v_report_overdue_states_count_daily limit 0;

drop procedure if exists refresh_report_overdue_states_count_daily;
DELIMITER //
CREATE PROCEDURE refresh_report_overdue_states_count_daily()
BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
delete from report_overdue_states_count_daily;
insert into report_overdue_states_count_daily select * from v_report_overdue_states_count_daily;
COMMIT;

END;
//
DELIMITER ;
42 changes: 42 additions & 0 deletions src/main/resources/reports/trial-starts-count-daily/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Daily Trials Count Report

Count of new trial subscriptions per tenant, per day and per product.

The snapshot view is: [v_report_trial_starts_count_daily](v_report_trial_starts_count_daily.md)

## Timeline configuration

```
curl -v \
-X POST \
-u admin:password \
-H "X-Killbill-ApiKey:bob" \
-H "X-Killbill-ApiSecret:lazar" \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_trials_start_count_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily Trials Count",
"sourceTableName": "report_trial_starts_count_daily",
"refreshProcedureName": "refresh_report_trial_starts_count_daily",
"refreshFrequency": "HOURLY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

### Sample Data

| Tenant Record Id | Day | Product | Count |
|------------------|------------|---------------|-------|
| 1 | 2025-07-01 | Assault-Rifle | 1 |
| 1 | 2025-05-05 | Pistol | 5 |
| 22 | 2025-09-18 | Pistol | 2 |
| 22 | 2025-07-01 | Pistol | 1 |
| 44 | 2025-07-08 | Blowdart | 8 |
| 44 | 2025-06-12 | Pistol | 6 |

This means that on `2025-09-18`, 2 new subscriptions were started in the `TRIAL` phase for the `Pistol` product and `tenant_record_id=1`.

## Report UI:

![daily-trials-count.png](daily-trials-count.png)


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create table report_trial_starts_count_daily as select * from v_report_trial_starts_count_daily limit 0;

drop procedure if exists refresh_report_trial_starts_count_daily;
DELIMITER //
CREATE PROCEDURE refresh_report_trial_starts_count_daily()
BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
delete from report_trial_starts_count_daily;
insert into report_trial_starts_count_daily select * from v_report_trial_starts_count_daily;
COMMIT;

END;
//
DELIMITER ;
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Daily Trials To No Trials Count Report

Count of subscriptions converting from trial to non-trial per tenant per day.

The snapshot view is: [v_report_trial_to_no_trial_conversions_daily](v_report_trial_to_no_trial_conversions_daily.ddl)

## Timeline configuration

```
curl -v \
-X POST \
-u admin:password \
-H "X-Killbill-ApiKey:bob" \
-H "X-Killbill-ApiSecret:lazar" \
-H 'Content-Type: application/json' \
-d '{"reportName": "report_trial_to_no_trial_conversions_daily",
"reportType": "TIMELINE",
"reportPrettyName": "Daily Trials to No Trials Count",
"sourceTableName": "report_trial_to_no_trial_conversions_daily",
"refreshProcedureName": "refresh_report_trial_to_no_trial_conversions_daily",
"refreshFrequency": "HOURLY"}' \
"http://127.0.0.1:8080/plugins/killbill-analytics/reports"
```

## Sample Data

| Tenant Record Id | Day | Count |
|------------------|------------|-------|
| 1 | 2025-06-04 | 1 |
| 1 | 2025-10-18 | 3 |
| 22 | 2025-08-07 | 1 |
| 22 | 2025-07-12 | 1 |
| 1 | 2025-01-31 | 1 |
| 45 | 2025-04-04 | 1 |
| 489 | 2025-09-05 | 1 |

This means that on `2025-10-18`, 3 subscriptions transitioned from the `TRIAL` phase to some other phase for the `tenant_record_id=1`.


## Report UI:

![trial-to-no-trial-conversions.png](trial-to-no-trial-conversions.png)



Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create table report_trial_to_no_trial_conversions_daily as select * from v_report_trial_to_no_trial_conversions_daily limit 0;

drop procedure if exists refresh_report_trial_to_no_trial_conversions_daily;
DELIMITER //
CREATE PROCEDURE refresh_report_trial_to_no_trial_conversions_daily()
BEGIN

DECLARE EXIT HANDLER FOR SQLEXCEPTION ROLLBACK;
DECLARE EXIT HANDLER FOR SQLWARNING ROLLBACK;

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
delete from report_trial_to_no_trial_conversions_daily;
insert into report_trial_to_no_trial_conversions_daily select * from v_report_trial_to_no_trial_conversions_daily;
COMMIT;

END;
//
DELIMITER ;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
create or replace view v_report_conversions_daily as
create or replace view v_report_trial_to_no_trial_conversions_daily as
select
ast.tenant_record_id
, date_format(ast.next_start_date,'%Y-%m-%d') as day
Expand All @@ -8,6 +8,7 @@ from
where 1=1
and ast.prev_phase='TRIAL'
and ast.next_phase!='TRIAL'
and ast.prev_service='billing-service'
and ast.report_group='default'
group by 1,2
;
12 changes: 0 additions & 12 deletions src/main/resources/reports/v_report_invoice_adjustments_daily.ddl

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/resources/sanity/README.md

This file was deleted.

Loading