# Invoice Cancellation [TOC] ## Objective The objective of Invoice cancellation, is to avoid deleting Invoice Revenue once it is recognised. The issue with deleting a recognised revenue is there is a chance that we might need to rebuild past month Client Revenue Change data once it is finalised. - Invoice can only be cancelled when there is no payment has been made. - Additionally, Invoice can only be deleted when it's in pre-issued states because Invoice Revenues are generated when the Invoice is issued. Once an invoice is issued, we no longer able to delete the Invoice. Then only option to remove the Invoice is through cancellation. - When an Invoice is cancelled, it will offset the total recognised revenues to zero by creating new invoice revenues with negating values. ## Worked Examples ### Example A Below shows an Invoice with a service period that spans across 1 month period and cancellation is made on the same month. Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | ------ | | Client A | 2022-01-01 to 2022-01-31 | USD 1000 | issued | Invoice Revenue | date_range | total amount | state | | ------------------------ | ------------ | ----------------- | | 2022-01-01 to 2022-01-31 | USD 1000 | recognised | Total recognised revenue (2022-01): USD 1000 Total unrecognised revenue: USD 0 Then, if we cancel above Invoice on 2022-01, following will be the updated records: Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | --------- | | Client A | 2022-01-01 to 2022-01-31 | USD 1000 | cancelled | Invoice Revenues | date_range | total amount | state | | ------------------------ | ------------ | ---------- | | 2022-01-01 to 2022-01-31 | USD 1000 | recognised | | 2022-01-01 to 2022-01-01 | USD -1000 | recognised | Total recognised revenue (2022-01): USD 0 Total unrecognised revenue: USD 0 ### Example B Below shows an Invoice with a service period that spans across 1 month period and cancellation is made on different month. Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | ------ | | Client A | 2022-01-01 to 2022-01-31 | USD 1000 | issued | Invoice Revenue | date_range | total amount | state | | ------------------------ | ------------ | ----------------- | | 2022-01-01 to 2022-01-31 | USD 1000 | recognised | Total recognised revenue (2022-01): USD 1000 Total unrecognised revenue: USD 0 Then, if we cancel above Invoice on 2022-02, following will be the updated records: Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | --------- | | Client A | 2022-01-01 to 2022-01-31 | USD 1000 | cancelled | Invoice Revenues | date_range | total amount | state | | ------------------------ | ------------ | ---------- | | 2022-01-01 to 2022-01-31 | USD 1000 | recognised | | 2022-02-01 to 2022-02-01 | USD -1000 | recognised | Total recognised revenue (2022-01): USD 1000 Total recognised revenue (2022-02): USD -1000 Total unrecognised revenue: USD 0 ### Example C Below shows an Invoice with a service period that spans across 3 months period and cancellation is made on the 2nd month. Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | ------ | | Client B | 2022-01-01 to 2022-03-31 | USD 3000 | issued | Invoice Revenues | date_range | total amount | state | | ------------------------ | ------------ | ----------------- | | 2022-01-01 to 2022-01-31 | USD 1000 | recognised | | 2022-02-01 to 2022-02-28 | USD 1000 | approval_required | | 2022-03-01 to 2022-03-31 | USD 1000 | initial | Total recognised revenue (2022-01): USD 1000 Total unrecognised revenue: USD 2000 Then, if we cancel above Invoice on 2022-02, following will be the updated records: Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | --------- | | Client B | 2022-01-01 to 2022-03-31 | USD 3000 | cancelled | Invoice Revenues | date_range | total amount | state | | ------------------------ | ------------ | ---------- | | 2022-01-01 to 2022-01-31 | USD 1000 | recognised | | 2022-02-01 to 2022-02-28 | USD 1000 | cancelled | | 2022-03-01 to 2022-03-31 | USD 1000 | cancelled | | 2022-02-01 to 2022-02-01 | USD -1000 | recognised | Total recognised revenue (2022-01): USD 1000 Total recognised revenue (2022-02): USD -1000 Total unrecognised revenue: USD 0 ### Example D Below shows an Invoice with a service period that spans across 3 months period and cancellation is made on the 1st month. Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | ------ | | Client B | 2022-01-01 to 2022-03-31 | USD 3000 | issued | Invoice Revenues | date_range | total amount | state | | ------------------------ | ------------ | ----------------- | | 2022-01-01 to 2022-01-31 | USD 1000 | approval_required | | 2022-02-01 to 2022-02-28 | USD 1000 | initial | | 2022-03-01 to 2022-03-31 | USD 1000 | initial | Total recognised revenue (2022-01): USD 0 Total recognised revenue (2022-02): USD 0 Total recognised revenue (2022-03): USD 0 Total unrecognised revenue: USD 3000 Then, if we cancel above Invoice on 2022-01, following will be the updated records: Invoice | client | date_range | total amount | state | | -------- | ------------------------ | ------------ | --------- | | Client B | 2022-01-01 to 2022-03-31 | USD 3000 | cancelled | Invoice Revenues | date_range | total amount | state | | ------------------------ | ------------ | --------- | | 2022-01-01 to 2022-01-31 | USD 1000 | cancelled | | 2022-02-01 to 2022-02-28 | USD 1000 | cancelled | | 2022-03-01 to 2022-03-31 | USD 1000 | cancelled | Total recognised revenue (2022-01): USD 0 Total recognised revenue (2022-02): USD 0 Total recognised revenue (2022-03): USD 0 Total unrecognised revenue: USD 0