# FundCustodian — CiC Test Data Reference
Generated: 2026-05-28 | Status: **PRE-WIPE** (test data in DB)

---

## System Design in One Paragraph

Each person who physically holds company money is a **custodian**. Their **wallet balance** in the DB tracks how much money they *should* have in hand at any moment (positive = holding money, negative = given out more than received). Pramod is the **primary** custodian (source of all funds). When Pramod sends ₹30,000 to Shambhu via NEFT, Pramod's wallet goes -30,000 and Shambhu's goes +30,000. When Shambhu gives ₹5,000 cash advance to Mukesh for a tour, Shambhu's wallet goes -5,000. The system does **double-entry** automatically via DB triggers — you never manually update balances.

---

## The 4 Custodians

| ID | Name | Type | Role |
|---|---|---|---|
| `pramod` | Pramod Narang | **primary** | Source of all funds. Admin. |
| `harish` | Harish Kumar Lal | secondary | Admin. Can see all balances. |
| `shambhu` | Shambhu | secondary | Non-admin. Field fund holder. |
| `gurpreet` | Gurpreet | secondary | Non-admin. Recently added. |

---

## The 3 Trigger Rules (Core Logic)

| Scenario | What happens at INSERT |
|---|---|
| **Non-cash transfer** (UPI/NEFT/IMPS/Cheque) | `status = auto_accepted`. Both wallets update immediately. |
| **Cash transfer — entered by RECEIVER** | `status = auto_accepted`. Both wallets update immediately. (Receiver confirms they got it.) |
| **Cash transfer — entered by GIVER** | `status = pending_acceptance`. Only GIVER wallet debits. Receiver must Accept or Reject via dashboard banner. On Accept → receiver credited. On Reject → giver refunded. |

---

## 15 Test Transfers (Chronological)

### T1 · Pramod → Shambhu · ₹25,000 · IMPS · 5-May · `auto_accepted`
- Pramod sent ₹25,000 via IMPS, entered from Shambhu's side (receiver perspective)
- Because receiver entered it → auto_accepted immediately
- Pramod: -25,000 · Shambhu: +25,000

### T2 · Pramod → Shambhu · ₹30,000 · NEFT · 8-May · `auto_accepted`
- Pramod allocated field operations fund. Non-cash = auto_accepted.
- Pramod: -30,000 · Shambhu: +30,000

### T3 · Pramod → Harish · ₹15,000 · NEFT · 10-May · `auto_accepted`
- Monthly operating funds. Non-cash = auto_accepted.
- Pramod: -15,000 · Harish: +15,000

### T4 · Harish → Shambhu · ₹8,000 · UPI · 11-May · `auto_accepted`
- Harish sent branding material advance to Shambhu. Non-cash.
- Harish: -8,000 · Shambhu: +8,000

### T5 · Pramod → Gurpreet · ₹5,000 · UPI · 12-May · `auto_accepted`
- First fund for new custodian Gurpreet. Non-cash.
- Pramod: -5,000 · Gurpreet: +5,000

### T6 · Gurpreet → Pramod · ₹1,234.56 · UPI · 13-May · `auto_accepted`
- Gurpreet returning unused funds (decimal amount). Non-cash.
- Gurpreet: -1,234.56 · Pramod: +1,234.56

### T7 · Harish → Pramod · ₹10,000 · Cheque · 14-May · `auto_accepted`
- Cheque CHQ-001223. Non-cash = auto_accepted.
- Harish: -10,000 · Pramod: +10,000

### T8 · Harish → Shambhu · ₹500 · Cash · 15-May · `auto_accepted`
- Small top-up. Cash but entered by **receiver** (Shambhu) → auto_accepted.
- Harish: -500 · Shambhu: +500

### T9 · Shambhu → Pramod · ₹5,000 · Cash · 15-May · `accepted`
- Cash handover. Entered by **giver** (Shambhu) → started as `pending`.
- Pramod accepted it via dashboard banner.
- Shambhu: -5,000 · Pramod: +5,000

### T10 · Gurpreet → Harish · ₹2,000 · Cash · 16-May · `accepted`
- Cash from field after Ludhiana activation. Giver-entered → `pending`, then accepted by Harish.
- Very long notes (tests truncation in ledger rows).
- Gurpreet: -2,000 · Harish: +2,000

### T11 · Pramod → Gurpreet · ₹1 · Cash · 16-May · `auto_accepted`
- Minimum ₹1 edge case. Receiver-entered cash → auto_accepted.
- Pramod: -1 · Gurpreet: +1

### T12 · Shambhu → Harish · ₹7,500 · Cash · 17-May · `rejected`
- Cash handover. Giver-entered → `pending`. Harish rejected with reason: "Amount does not match what I actually received — please recount and resubmit".
- **On rejection: Shambhu wallet refunded +7,500**
- Net: no change to either wallet

### T13 · Gurpreet → Pramod · ₹3,000 · Cash · 18-May · `rejected`
- Giver-entered → `pending`. Pramod rejected with **no reason** (null rejection_reason allowed).
- **On rejection: Gurpreet wallet refunded +3,000**
- Net: no change to either wallet

### T14 · Shambhu → Harish · ₹3,000 · Cash · 20-May · seeded as `pending`
- Weekly field cash handover. Giver-entered → `pending` at seed time.
- During CiC testing this was accepted → Harish: +3,000 · Shambhu: -3,000 locked in
- ⚠️ Note: live DB shows `accepted` but balance may be inconsistent — wipe resolves this.

### T15 · Gurpreet → Harish · ₹800 · Cash · 20-May · seeded as `pending`
- Market visit collection. Giver-entered → `pending` at seed time.
- During CiC testing this was accepted too.
- ⚠️ Same note as T14.

---

## 9 Test Advances (Chronological)

### A1 · Shambhu → Mukesh · ₹5,000 · Cash · 12-May · `outstanding`
- Tour advance for Chandigarh–Amritsar trip.
- Shambhu wallet: -5,000

### A2 · Shambhu → Sachin · ₹2,500 · Cash · 10-May · `partially_settled`
- Vehicle fuel advance. One settlement of ₹1,000 applied via Expense Sheet ES-2026-0042.
- Outstanding: ₹1,500

### A3 · Harish → Narender · ₹3,000 · Cash · 8-May · `settled`
- Tour advance for Delhi activation. Fully settled via two sheets (₹1,500 + ₹1,500).
- Outstanding: ₹0

### A4 · Pramod → Umashankar · ₹20,000 · NEFT · 14-May · `outstanding`
- Amritsar activation campaign expenses. Large non-cash advance with reference.
- Pramod wallet: -20,000

### A5 · Harish → Mukesh · ₹1,500 · UPI · 15-May · `outstanding`
- Second advance to Mukesh (Ludhiana fuel). Employee has multiple outstanding advances.
- Harish wallet: -1,500

### A6 · Shambhu → Ranjit Singh (Contract) · ₹800 · IMPS · 16-May · `outstanding`
- Contract labour advance. Uses "Other" employee (not in employee list).
- Shambhu wallet: -800

### A7 · Pramod → Rakesh · ₹10,000 · Cash · 13-May · `partially_settled`
- Tour advance for Ludhiana belt. Two partial settlements: ₹2,500 + ₹1,500 = ₹4,000 applied.
- Outstanding: ₹6,000

### A8 · Gurpreet → Ashok · ₹750 · Cash · 17-May · `outstanding`
- Market visit expenses. Small amount from new custodian.
- Gurpreet wallet: -750

### A9 · Pramod → Ramesh Thakur (Vendor) · ₹5,000.75 · Cash · 9-May · `outstanding`
- Flex printing vendor advance. Decimal amount. "Other" vendor type.
- Pramod wallet: -5,000.75

---

## Wallet Balance Derivation (After Full Seed + CiC Acceptance of T14 & T15)

| Custodian | Expected (seed only) | Live |
|---|---|---|
| Pramod | ₹-43,767.19 | ₹-43,767.19 |
| Harish | ₹-6,000.00 | ₹-6,000.00 |
| Shambhu | ₹-2,800.00 | ₹-2,800.00 |
| Gurpreet | ₹+216.44 | ₹+216.44 |

---

## What the Test Data Covered

| Feature Tested | Transactions |
|---|---|
| Non-cash (NEFT/UPI/IMPS/Cheque) auto-accept | T1–T8 |
| Cash receiver-entered auto-accept | T8, T11 |
| Cash giver-entered → pending → accept flow | T9, T10, T14, T15 |
| Cash giver-entered → pending → reject with reason | T12 |
| Cash giver-entered → pending → reject without reason | T13 |
| Decimal amount precision | T6 (₹1,234.56), A9 (₹5,000.75) |
| Minimum amount (₹1) | T11 |
| Long notes truncation in ledger | T10 |
| Multiple pending on one dashboard | T14 + T15 both for Harish |
| Outstanding advance | A1, A4, A5, A6, A8, A9 |
| Partially settled advance | A2 (1 settlement), A7 (2 settlements) |
| Fully settled advance | A3 (2 settlements) |
| "Other" employee (not in list) | A6 (Ranjit Singh Contract), A9 (Ramesh Thakur Vendor) |
| Employee with multiple advances | Mukesh (A1 from Shambhu + A5 from Harish) |
| Admin sees all custodian balances | Harish/Pramod login |
| Access Restricted for non-custodian | Mukesh login |

---

*File location: /var/www/360lm/cic-prompts/custodian_test_data_reference.md*
