Skip to content

Invoice Reversal

Overview

Invoice Reversal is a critical accounting feature that allows you to undo an invoice and revert all related financial transactions. This includes subscriber profile restoration, balance refunds, profit reversals, and RADIUS configuration updates. The system handles both Full Reversal and Partial Reversal with automatic pro-rata calculations.

Why It's Important:

  • 💰 Financial Accuracy - Correct accounting mistakes
  • 🔄 Complete Reversal - Reverts subscriber, reseller, and admin transactions
  • 📊 Pro-rata Calculation - Partial refunds based on time used
  • 💳 Payment Method Aware - Different handling for cash vs balance payments
  • 🔐 Transaction Safety - Database transactions ensure data integrity
  • 📝 Audit Trail - Complete logging of all reversal activities

How Invoice Reversal Works

Reversal Flow

1. Validate Invoice (not reversed, not migrated, latest only)

2. Fetch Activation Records (Pre & Post activation data)

3. Revert Subscriber Profile (status, package, expiration)

4. Revert Subscriber Payment/Balance (refund handling)

5. Revert Reseller Profits (multi-tier, payment-aware)

6. Update Invoice Status to "Reversed" (7)

7. Log All Activities (complete audit trail)

Reversal Types

1. Full Reversal

What Happens:

✅ 100% refund to subscriber
✅ Subscriber profile restored to pre-activation state
✅ Expiration date set to previous date
✅ All profits reversed completely
✅ All balances restored fully

Use Cases:

✅ Invoice created by mistake
✅ Wrong package assigned
✅ Wrong subscriber selected
✅ Duplicate invoice
✅ Service not delivered

2. Partial Reversal

What Happens:

✅ Pro-rata refund based on time used
✅ Subscriber profile restored to pre-activation state
✅ Expiration date set to today
✅ Profits reversed proportionally
✅ Balances restored proportionally

Calculation:

Unused Percentage = 1 - (Used Days / Total Duration)
Refund Amount = Invoice Amount × Unused Percentage
Profit Reversal = Profit × Unused Percentage

Example:

Invoice: 30 days for 300 BDT
Used: 10 days
Unused: 20 days
Unused Percentage: 20/30 = 66.67%
Refund: 300 × 66.67% = 200 BDT

Use Cases:

✅ Subscriber wants to cancel early
✅ Subscriber moving to different location
✅ Service quality issues
✅ Package downgrade needed

Payment Method Handling

Critical Concept: Cash vs Balance Payments

Payment Methods:

Cash Payments (Methods 1, 2, 3):
  1 = Cash
  2 = Bank Transfer
  3 = Cheque

Balance Payment (Method 4):
  4 = Balance

Online Payments (Methods 11+):
  11+ = Online Gateways (bKash, Nagad, etc.)

Cash Payment Reversal (Methods 1, 2, 3)

What Happened During Activation:

1. Subscriber paid 130 BDT CASH to Reseller (OUTSIDE system)
2. Reseller's balance CUT -120 BDT (to pay upstream cost to Admin)
3. Reseller's profit 10 BDT marked as "in cash" (no_balance_change = true)
4. Reseller has:
   - 130 BDT cash in hand
   - -120 BDT system balance
   - 10 BDT profit in cash

What Happens During Reversal:

1. Reseller MUST return 130 BDT CASH to subscriber (OUTSIDE system)
2. System RETURNS +120 BDT to Reseller's balance
3. Profit reversal tracked (no_balance_change = true)
4. Reseller has:
   - 0 BDT cash (returned)
   - 0 BDT system balance (got back 120)
   - 0 BDT profit

Accounting Entries:

Subscriber Ledger:

Type: Payment (1)
Amount: +130 BDT (tracking only)
no_balance_change: true
Note: "Invoice Reversed - Reseller Must Return Cash: 130.00 BDT"

Reseller Price Ledger:

Type: Invoice (3)
Amount: +120 BDT (RETURN balance)
no_balance_change: false
Note: "Subscriber Invoice Reverted"

Reseller Profit Ledger:

Type: Profit (4)
Amount: -10 BDT (tracking only)
no_balance_change: true
Note: "Invoice Reversed - Reseller Must Return Profit Cash: 10.00 BDT"

Balance/Online Payment Reversal (Methods 4, 11+)

What Happened During Activation:

1. Subscriber paid 130 BDT via SYSTEM BALANCE or ONLINE
2. Reseller's balance NOT cut (subscriber already paid)
3. Reseller's profit 10 BDT ADDED to balance (no_balance_change = false)
4. Reseller has:
   - 0 BDT cash
   - +10 BDT system balance
   - 10 BDT profit in balance

What Happens During Reversal:

1. System REFUNDS +130 BDT to Subscriber's balance
2. NO balance return to Reseller (didn't pay anything)
3. System CUTS -10 BDT from Reseller's balance
4. Reseller has:
   - 0 BDT cash
   - 0 BDT system balance
   - 0 BDT profit

Accounting Entries:

Subscriber Ledger:

Type: Payment (1)
Amount: +130 BDT (ADD to balance)
no_balance_change: false
Note: "Invoice Reversed - Balance Refunded: 130.00 BDT"

Reseller Price Ledger:

Type: Invoice (3)
Amount: 0 BDT (no return)
no_balance_change: false
Note: "Subscriber Invoice Reverted"

Reseller Profit Ledger:

Type: Profit (4)
Amount: -10 BDT (CUT from balance)
no_balance_change: false
Note: "Invoice Reversed - Profit Cut From Balance"

Multi-tier Profit Reversal

Profit Distribution Example

Admin (Parent Net: 100 BDT, Profit: 5 BDT)

Reseller (Parent Net: 105 BDT, Profit: 10 BDT)

Subreseller (Parent Net: 115 BDT, Profit: 10 BDT)

Subscriber (Final Price: 125 BDT)

Direct Salesperson (Who Sold to Subscriber)

Cash Payment:

✅ Return upstream cost to balance (+115 BDT)
✅ Track profit reversal (-10 BDT, no balance change)
✅ Must return cash to subscriber physically

Balance/Online Payment:

✅ No upstream cost return (0 BDT)
✅ Cut profit from balance (-10 BDT)
✅ Subscriber balance refunded by system

Parent Resellers (Upstream)

ALWAYS (Regardless of Payment Method):

✅ Cut profit from balance
✅ no_balance_change: false
✅ Parent resellers ALWAYS get profit in balance
✅ Never handle cash

Step-by-Step Guide

Step 1: Access Invoice

  1. Go to AccountingSales Invoice
  2. Find the invoice to reverse
  3. Click View Invoice

Step 2: Check Eligibility

Invoice Must:

✅ Not be reversed (status ≠ 7)
✅ Not be migrated (type ≠ 3)
✅ Be the latest invoice for subscriber

Step 3: Click "Reverse Invoice"

Modal Opens:

- Reversal Type (Full/Partial)
- Reason (Required, max 255 chars)
- Refund Amount (Auto-calculated)

Step 4: Select Reversal Type

Full Reversal:

Refund: 100% of invoice amount
Expiration: Set to previous date
Use When: Mistake, wrong package, not delivered

Partial Reversal:

Refund: Pro-rata based on time used
Expiration: Set to today
Use When: Early cancellation, partial usage

Step 5: Enter Reason

Examples:

✅ "Invoice created by mistake"
✅ "Subscriber requested cancellation"
✅ "Wrong package assigned"
✅ "Service quality issues"

Step 6: Review Summary

System Shows:

- Subscriber refund amount
- Reseller balance changes
- Profit reversals
- Profile changes

Step 7: Confirm Reversal

Success:

✅ Invoice status → Reversed (7)
✅ Subscriber profile restored
✅ Balances updated
✅ Profits reversed
✅ Activity logged

What Gets Reverted

1. Subscriber Profile

Profile Status: Current → Previous
Package ID: Current → Previous
Salesperson ID: Current → Previous
Expiration Date: Current → Previous (or Today)

2. RADIUS Configuration

Full Reversal:

✅ Expiration → previous date
✅ If new subscriber: Delete username/password

Partial Reversal:

✅ Expiration → today
✅ Allows used days calculation

3. Subscriber Balance

Cash Payment:

Ledger: +Amount (tracking only, no_balance_change = true)
Action: Reseller must return cash physically

Balance/Online:

Ledger: +Amount (ADD to balance, no_balance_change = false)
Action: Automatic balance refund

4. Payment & Cashflow

Payment Status: Paid (1) → Reverted (2)
Cashflow Status: Active (1) → Reverted (2)
Notes: Appended with "(Reverted Payment)"

5. Reseller Accounting

Direct Salesperson (Cash):

Price: +Upstream Cost (return balance)
Profit: -Amount (tracking only, no balance change)

Direct Salesperson (Balance/Online):

Price: 0 (no return)
Profit: -Amount (cut from balance)

Parent Resellers:

Profit: -Amount (ALWAYS cut from balance)

6. Invoice Status

Status: Paid (1) → Reversed (7)
Body Note: Reversal reason
Updated At: Current timestamp

Accounting Summary

Full Reversal - Cash Payment

Subscriber: +130 BDT (tracking, must receive cash)
Salesperson: +115 BDT (upstream cost returned)
Salesperson Profit: -10 BDT (tracking, must return cash)
Parent Reseller: -10 BDT (profit cut from balance)
Admin: -5 BDT (profit cut from balance)

Full Reversal - Balance/Online

Subscriber: +130 BDT (balance refunded)
Salesperson: 0 BDT (no upstream cost)
Salesperson Profit: -10 BDT (cut from balance)
Parent Reseller: -10 BDT (profit cut from balance)
Admin: -5 BDT (profit cut from balance)

Partial Reversal (66.67% Unused)

Refund: 66.67% of amounts
Profits: 66.67% reversed
Same logic as full, but proportional

Common Use Cases

Use Case 1: Wrong Package (Full)

Scenario: Staff assigned wrong package

Steps:

  1. Reverse invoice (Full)
  2. Reason: "Wrong package assigned"
  3. Inform reseller to return cash (if cash payment)
  4. Create correct invoice

Use Case 2: Early Cancellation (Partial)

Scenario: Subscriber used 10 of 30 days

Steps:

  1. Reverse invoice (Partial)
  2. System calculates 66.67% refund
  3. Reason: "Subscriber requested cancellation"
  4. Confirm reversal

Use Case 3: Duplicate Invoice (Full)

Scenario: Accidentally created duplicate

Steps:

  1. Identify duplicate
  2. Reverse invoice (Full)
  3. Reason: "Duplicate invoice"
  4. Original invoice remains active

Best Practices

Before Reversing

✅ Verify correct invoice
✅ Confirm with subscriber
✅ Know payment method
✅ Document reason
✅ Check it's latest invoice

Reversal Type Selection

Full When:

✅ Mistake/error
✅ Within 24 hours
✅ Service not delivered

Partial When:

✅ Service partially used
✅ Fair refund needed
✅ Early cancellation

Cash Payment Handling

⚠️ System tracks only, doesn't change balance
⚠️ Reseller MUST physically return cash
⚠️ Admin must inform reseller
⚠️ Document cash return

Documentation

✅ Clear reason
✅ Subscriber request details
✅ Ticket number (if exists)
✅ Cash return confirmation

Troubleshooting

Issue 1: Already Reversed

Error: "Invoice Is Already Reversed"

Solution: Invoice already reversed, check ledger for entries


Issue 2: Migrated Invoice

Error: "Migrated Invoice Can Not Be Reversed"

Solution: Create manual adjustment, contact admin


Issue 3: Not Latest Invoice

Error: "You Can Only Reverse The Latest Invoice"

Solution: Reverse newer invoices first, or contact admin


Issue 4: Activation Records Not Found

Error: "Activation Records Not Found"

Solution: Contact admin, may need manual reversal


Issue 5: Balance Not Updated

Problem: Subscriber balance not showing refund

Solutions:

  1. Check payment method (cash = no balance change)
  2. Verify ledger entries created
  3. Check no_balance_change flag
  4. Refresh subscriber profile

Summary

Invoice Reversal is critical for financial accuracy!

✅ Key Takeaways:

  1. Two Types - Full (100%) and Partial (pro-rata)
  2. Payment Aware - Different handling for cash vs balance
  3. Multi-tier - Reverses all reseller profits
  4. Complete - Subscriber, RADIUS, payments, profits
  5. Safe - Database transactions ensure integrity
  6. Tracked - Complete audit trail

✅ Reversal Rules:

✅ Latest invoice only
✅ Not already reversed
✅ Not migrated invoice
✅ Reason required
✅ Payment method matters

✅ Cash vs Balance:

Cash: Tracking only, physical return required
Balance: Automatic refund to balance
Online: Automatic refund to balance

✅ Profit Reversal:

Direct Salesperson: Payment method dependent
Parent Resellers: ALWAYS cut from balance

Perfect for ISPs needing accurate financial reversals! 🔄

www.onezeroart.com