Appearance
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 fullyUse Cases:
✅ Invoice created by mistake
✅ Wrong package assigned
✅ Wrong subscriber selected
✅ Duplicate invoice
✅ Service not delivered2. 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 proportionallyCalculation:
Unused Percentage = 1 - (Used Days / Total Duration)
Refund Amount = Invoice Amount × Unused Percentage
Profit Reversal = Profit × Unused PercentageExample:
Invoice: 30 days for 300 BDT
Used: 10 days
Unused: 20 days
Unused Percentage: 20/30 = 66.67%
Refund: 300 × 66.67% = 200 BDTUse Cases:
✅ Subscriber wants to cancel early
✅ Subscriber moving to different location
✅ Service quality issues
✅ Package downgrade neededPayment 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 cashWhat 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 profitAccounting 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 balanceWhat 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 profitAccounting 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 physicallyBalance/Online Payment:
✅ No upstream cost return (0 BDT)
✅ Cut profit from balance (-10 BDT)
✅ Subscriber balance refunded by systemParent Resellers (Upstream)
ALWAYS (Regardless of Payment Method):
✅ Cut profit from balance
✅ no_balance_change: false
✅ Parent resellers ALWAYS get profit in balance
✅ Never handle cashStep-by-Step Guide
Step 1: Access Invoice
- Go to Accounting → Sales Invoice
- Find the invoice to reverse
- Click View Invoice
Step 2: Check Eligibility
Invoice Must:
✅ Not be reversed (status ≠ 7)
✅ Not be migrated (type ≠ 3)
✅ Be the latest invoice for subscriberStep 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 deliveredPartial Reversal:
Refund: Pro-rata based on time used
Expiration: Set to today
Use When: Early cancellation, partial usageStep 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 changesStep 7: Confirm Reversal
Success:
✅ Invoice status → Reversed (7)
✅ Subscriber profile restored
✅ Balances updated
✅ Profits reversed
✅ Activity loggedWhat 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/passwordPartial Reversal:
✅ Expiration → today
✅ Allows used days calculation3. Subscriber Balance
Cash Payment:
Ledger: +Amount (tracking only, no_balance_change = true)
Action: Reseller must return cash physicallyBalance/Online:
Ledger: +Amount (ADD to balance, no_balance_change = false)
Action: Automatic balance refund4. 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 timestampAccounting 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 proportionalCommon Use Cases
Use Case 1: Wrong Package (Full)
Scenario: Staff assigned wrong package
Steps:
- Reverse invoice (Full)
- Reason: "Wrong package assigned"
- Inform reseller to return cash (if cash payment)
- Create correct invoice
Use Case 2: Early Cancellation (Partial)
Scenario: Subscriber used 10 of 30 days
Steps:
- Reverse invoice (Partial)
- System calculates 66.67% refund
- Reason: "Subscriber requested cancellation"
- Confirm reversal
Use Case 3: Duplicate Invoice (Full)
Scenario: Accidentally created duplicate
Steps:
- Identify duplicate
- Reverse invoice (Full)
- Reason: "Duplicate invoice"
- Original invoice remains active
Best Practices
Before Reversing
✅ Verify correct invoice
✅ Confirm with subscriber
✅ Know payment method
✅ Document reason
✅ Check it's latest invoiceReversal Type Selection
Full When:
✅ Mistake/error
✅ Within 24 hours
✅ Service not deliveredPartial When:
✅ Service partially used
✅ Fair refund needed
✅ Early cancellationCash Payment Handling
⚠️ System tracks only, doesn't change balance
⚠️ Reseller MUST physically return cash
⚠️ Admin must inform reseller
⚠️ Document cash returnDocumentation
✅ Clear reason
✅ Subscriber request details
✅ Ticket number (if exists)
✅ Cash return confirmationTroubleshooting
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:
- Check payment method (cash = no balance change)
- Verify ledger entries created
- Check no_balance_change flag
- Refresh subscriber profile
Summary
Invoice Reversal is critical for financial accuracy!
✅ Key Takeaways:
- Two Types - Full (100%) and Partial (pro-rata)
- Payment Aware - Different handling for cash vs balance
- Multi-tier - Reverses all reseller profits
- Complete - Subscriber, RADIUS, payments, profits
- Safe - Database transactions ensure integrity
- 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 balancePerfect for ISPs needing accurate financial reversals! 🔄
