# 4. Invoicing — Test Cases

User Type: **Super Administrator**
Source: *Mi Digital Academy - Education CRM Features Document*
Spec: invoicing.md — every feature, sub-feature, and rule covered

---

## Test Execution Policy
- Zero tolerance: any deviation from documented behavior = FAILED = bug
- Every bug is immediately logged/reported (Bug ID, feature, sub-feature,
  expected vs actual, severity) and fixed 100% before the group passes
- Feature group passes only at 100% test pass rate

## Coverage Matrix
| Feature | Sub-feature / Rule | Test IDs |
|---------|--------------------|----------|
| 4.1 Generate Invoices and Receipts | Invoice generation: the generation (the invoice, the items, the amount, the date) | TC-SA-15-04-001 |
| 4.1 Generate Invoices and Receipts | Receipt generation: the generation (the receipt, the payment, the amount, the date) | TC-SA-15-04-002 |
| 4.1 Generate Invoices and Receipts | Invoice detail: the detail (the invoice, the items, the amount, the tax, the total) | TC-SA-15-04-003 |
| 4.1 Generate Invoices and Receipts | Receipt detail: the detail (the receipt, the payment, the amount, the method, the date) | TC-SA-15-04-004 |
| 4.1 Generate Invoices and Receipts | Invoice numbering: the numbering (the invoice number, the sequence) | TC-SA-15-04-005 |
| 4.1 Generate Invoices and Receipts | Invoice record: the record (the invoice, the items, the amount, the date) | TC-SA-15-04-006 |
| 4.1 Generate Invoices and Receipts | Audit logging of the invoice and receipt generation | TC-SA-15-04-007 |
| 4.1 Generate Invoices and Receipts | Rule: the invoice generation is the document (the invoice, the items, the amount, the date); the generation is the creation | TC-SA-15-04-001 |
| 4.1 Generate Invoices and Receipts | Rule: the receipt generation is the proof (the receipt, the payment, the amount, the date); the generation is the creation | TC-SA-15-04-002 |
| 4.1 Generate Invoices and Receipts | Rule: the invoice detail is the content (the invoice, the items, the amount, the tax, the total); the detail is the structure | TC-SA-15-04-003 |
| 4.1 Generate Invoices and Receipts | Rule: the invoice numbering is the identifier (the invoice number, the sequence); the numbering is the reference | TC-SA-15-04-005 |
| 4.1 Generate Invoices and Receipts | Rule: the invoices and receipts are visible (the invoices, the receipts, the amounts, the dates); the generation is managed | TC-SA-15-04-001 |
| 4.1 Generate Invoices and Receipts | Rule: invoice and receipt generation are audit-logged with the invoice, amount, and timestamp | TC-SA-15-04-007 |
| 4.2 Invoice History and Retrieval | Invoice history: the history (the invoices, the dates, the amounts, the statuses) | TC-SA-15-04-008 |
| 4.2 Invoice History and Retrieval | Invoice retrieval: the retrieval (the invoice is found by the user, the date, the amount) | TC-SA-15-04-009 |
| 4.2 Invoice History and Retrieval | Invoice filter: the filter (the filter by the user, the date, the amount, the status) | TC-SA-15-04-010 |
| 4.2 Invoice History and Retrieval | Invoice search: the search (the search by the invoice number, the user) | TC-SA-15-04-011 |
| 4.2 Invoice History and Retrieval | Invoice download: the download (the invoice is downloaded, the format) | TC-SA-15-04-012 |
| 4.2 Invoice History and Retrieval | Invoice record: the record (the invoice, the date, the amount, the status) | TC-SA-15-04-013 |
| 4.2 Invoice History and Retrieval | Audit logging of the invoice retrieval | TC-SA-15-04-014 |
| 4.2 Invoice History and Retrieval | Rule: the invoice history is the record (the invoices, the dates, the amounts, the statuses); the history is the timeline | TC-SA-15-04-008 |
| 4.2 Invoice History and Retrieval | Rule: the invoice retrieval is the access (the invoice is found by the user, the date, the amount); the retrieval is the lookup | TC-SA-15-04-009 |
| 4.2 Invoice History and Retrieval | Rule: the invoice filter is the scope (the filter by the user, the date, the amount, the status); the filter is the control | TC-SA-15-04-010 |
| 4.2 Invoice History and Retrieval | Rule: the invoice search is the lookup (the search by the invoice number, the user); the search is the access | TC-SA-15-04-011 |
| 4.2 Invoice History and Retrieval | Rule: the invoices are visible (the invoices, the filters, the period); the retrieval is managed | TC-SA-15-04-008 |
| 4.2 Invoice History and Retrieval | Rule: invoice retrieval is audit-logged with the invoice, filter, and timestamp | TC-SA-15-04-014 |
| 4.3 Branded Invoices for Institutes | Institute branding: the branding (the institute's branding, the logo, the colors, the name) | TC-SA-15-04-015 |
| 4.3 Branded Invoices for Institutes | Branded invoice: the invoice (the invoice, the branding, the items, the amount) | TC-SA-15-04-016 |
| 4.3 Branded Invoices for Institutes | Branding configuration: the configuration (the institute, the branding, the invoice) | TC-SA-15-04-017 |
| 4.3 Branded Invoices for Institutes | Invoice generation: the generation (the invoice is generated with the branding) | TC-SA-15-04-018 |
| 4.3 Branded Invoices for Institutes | Invoice record: the record (the invoice, the branding, the items, the amount, the date) | TC-SA-15-04-019 |
| 4.3 Branded Invoices for Institutes | Invoice view: the view (the invoices, the institutes, the period) | TC-SA-15-04-020 |
| 4.3 Branded Invoices for Institutes | Audit logging of the branded invoice generation | TC-SA-15-04-021 |
| 4.3 Branded Invoices for Institutes | Rule: the institute branding is the identity (the institute's branding, the logo, the colors, the name); the branding is the mark | TC-SA-15-04-015 |
| 4.3 Branded Invoices for Institutes | Rule: the branded invoice is the document (the invoice, the branding, the items, the amount); the invoice is the proof | TC-SA-15-04-016 |
| 4.3 Branded Invoices for Institutes | Rule: the branding configuration is the control (the institute, the branding, the invoice); the configuration is the setup | TC-SA-15-04-017 |
| 4.3 Branded Invoices for Institutes | Rule: a branding change (the logo, the colors, the name updated) is recorded (the new logo, the new colors, the new name, the time); it is auditable | TC-SA-15-04-021 |
| 4.3 Branded Invoices for Institutes | Rule: the branded invoices are visible (the invoices, the institutes, the period); the generation is managed | TC-SA-15-04-020 |
| 4.3 Branded Invoices for Institutes | Rule: branded invoice generation is audit-logged with the institute, branding, and timestamp | TC-SA-15-04-021 |

## 4.1 Generate Invoices and Receipts

### TC-SA-15-04-001 — Invoice generation: the generation (the invoice, the items, the amount, the date); the generation is the creation
**Type:** Positive
**Covers:** 4.1 → Invoice generation: the generation (the invoice, the items, the amount, the date); Rule: the invoice generation is the document (the invoice, the items, the amount, the date); the generation is the creation; Rule: the invoices and receipts are visible (the invoices, the receipts, the amounts, the dates); the generation is managed
**Preconditions:** A payment has been made.
**Steps:**
1. Generate the invoice: the invoice (the invoice, the user, the items, the amount, the date).
2. Verify the invoice is generated and available (the invoice is sent to the user).
3. Verify the invoices are visible (the invoices, the amounts, the dates).
**Expected Result:** The invoice is generated — the invoice, the items, the amount, and the date are created and the invoice is sent to the user.
**Priority:** Critical

### TC-SA-15-04-002 — Receipt generation: the generation (the receipt, the payment, the amount, the date); the generation is the creation
**Type:** Positive
**Covers:** 4.1 → Receipt generation: the generation (the receipt, the payment, the amount, the date); Rule: the receipt generation is the proof (the receipt, the payment, the amount, the date); the generation is the creation
**Preconditions:** A payment has been made.
**Steps:**
1. Generate the receipt: the receipt (the receipt, the payment, the amount, the method, the date).
2. Verify the receipt is generated and available.
**Expected Result:** The receipt is generated — the receipt, the payment, the amount, and the date are created.
**Priority:** Critical

### TC-SA-15-04-003 — Invoice detail: the detail (the invoice, the items, the amount, the tax, the total); the detail is the structure
**Type:** Edge
**Covers:** 4.1 → Invoice detail: the detail (the invoice, the items, the amount, the tax, the total); Rule: the invoice detail is the content (the invoice, the items, the amount, the tax, the total); the detail is the structure
**Preconditions:** An invoice is generated with multiple items and tax.
**Steps:**
1. Open the invoice detail.
2. Verify it shows the invoice, the items, the amount, the tax, and the total.
3. Verify the total equals the sum of the items plus the tax (the math is correct).
**Expected Result:** The invoice detail is shown — the invoice, the items, the amount, the tax, and the total are visible and the total is correct.
**Priority:** High

### TC-SA-15-04-004 — Receipt detail: the detail (the receipt, the payment, the amount, the method, the date); the detail is the content
**Type:** Positive
**Covers:** 4.1 → Receipt detail: the detail (the receipt, the payment, the amount, the method, the date)
**Preconditions:** A receipt has been generated.
**Steps:**
1. Open the receipt detail.
2. Verify it shows the receipt, the payment, the amount, the method, and the date.
**Expected Result:** The receipt detail is shown — the receipt, the payment, the amount, the method, and the date are visible.
**Priority:** High

### TC-SA-15-04-005 — Invoice numbering: the numbering (the invoice number, the sequence); the numbering is the reference
**Type:** Edge
**Covers:** 4.1 → Invoice numbering: the numbering (the invoice number, the sequence); Rule: the invoice numbering is the identifier (the invoice number, the sequence); the numbering is the reference
**Preconditions:** Multiple invoices have been generated.
**Steps:**
1. Verify each invoice has a unique invoice number (the sequence).
2. Generate a new invoice — verify the number increments in the sequence (no duplicate, no gap).
3. Verify the numbering is the reference for the invoice.
**Expected Result:** The invoice numbering works — each invoice has a unique number in the sequence with no duplicates or gaps.
**Priority:** High

### TC-SA-15-04-006 — Invoice record: the record (the invoice, the items, the amount, the date); the record is the proof
**Type:** Positive
**Covers:** 4.1 → Invoice record: the record (the invoice, the items, the amount, the date)
**Preconditions:** An invoice and a receipt have been generated.
**Steps:**
1. Open the invoice record.
2. Verify it shows the invoice, the items, the amount, and the date.
**Expected Result:** The invoice is recorded — the invoice, the items, the amount, and the date are shown.
**Priority:** High

### TC-SA-15-04-007 — Invoice and receipt generation are audit-logged with the invoice, amount, and timestamp
**Type:** Positive
**Covers:** 4.1 → Audit logging of the invoice and receipt generation; Rule: invoice and receipt generation are audit-logged with the invoice, amount, and timestamp
**Preconditions:** Invoices and receipts have been generated.
**Steps:**
1. Open the audit trail and filter by "invoice generation".
2. Verify entries show the invoice, the amount, and the timestamp.
**Expected Result:** The invoice and receipt generation are audit-logged with the invoice, amount, and timestamp.
**Priority:** Critical

## 4.2 Invoice History and Retrieval

### TC-SA-15-04-008 — Invoice history: the history (the invoices, the dates, the amounts, the statuses); the history is the timeline
**Type:** Positive
**Covers:** 4.2 → Invoice history: the history (the invoices, the dates, the amounts, the statuses); Rule: the invoice history is the record (the invoices, the dates, the amounts, the statuses); the history is the timeline; Rule: the invoices are visible (the invoices, the filters, the period); the retrieval is managed
**Preconditions:** Invoices exist across multiple users and periods.
**Steps:**
1. View the invoice history: the invoices (the invoice, the user, the date, the amount, the status), the filters (the user, the date, the amount, the status), and the period (the period of the invoices).
2. Verify the history is the timeline and is complete for the period.
**Expected Result:** The invoice history is shown — the invoices, the dates, the amounts, and the statuses are visible.
**Priority:** Critical

### TC-SA-15-04-009 — Invoice retrieval: the retrieval (the invoice is found by the user, the date, the amount); the retrieval is the lookup
**Type:** Positive
**Covers:** 4.2 → Invoice retrieval: the retrieval (the invoice is found by the user, the date, the amount); Rule: the invoice retrieval is the access (the invoice is found by the user, the date, the amount); the retrieval is the lookup
**Preconditions:** Invoices exist for multiple users.
**Steps:**
1. Retrieve an invoice by the user — verify the user's invoices are found.
2. Retrieve an invoice by the date — verify the invoices for the date are found.
3. Retrieve an invoice by the amount — verify the invoices for the amount are found.
**Expected Result:** The invoice retrieval works — the invoice is found by the user, the date, or the amount.
**Priority:** High

### TC-SA-15-04-010 — Invoice filter: the filter (the filter by the user, the date, the amount, the status); the filter is the control
**Type:** Negative
**Covers:** 4.2 → Invoice filter: the filter (the filter by the user, the date, the amount, the status); Rule: the invoice filter is the scope (the filter by the user, the date, the amount, the status); the filter is the control
**Preconditions:** Invoices exist for multiple users, dates, amounts, and statuses.
**Steps:**
1. Set the invoice filter: the filter (the filter by the user, the date, the amount, the status).
2. Verify only the matching invoices are shown.
3. Apply a filter combination that matches no invoices — verify an empty result is shown (no error).
**Expected Result:** The invoice filter works — only the matching invoices are shown; an empty result is handled.
**Priority:** High

### TC-SA-15-04-011 — Invoice search: the search (the search by the invoice number, the user); the search is the access
**Type:** Edge
**Covers:** 4.2 → Invoice search: the search (the search by the invoice number, the user); Rule: the invoice search is the lookup (the search by the invoice number, the user); the search is the access
**Preconditions:** Invoices exist.
**Steps:**
1. Search an invoice by the invoice number — verify the exact invoice is found.
2. Search by the user — verify all the user's invoices are found.
3. Search by a non-existent invoice number — verify no results are shown (no error).
**Expected Result:** The invoice search works — the invoice is found by the invoice number or the user; a non-existent number returns no results.
**Priority:** High

### TC-SA-15-04-012 — Invoice download: the download (the invoice is downloaded, the format); the download is the export
**Type:** Positive
**Covers:** 4.2 → Invoice download: the download (the invoice is downloaded, the format)
**Preconditions:** An invoice exists.
**Steps:**
1. Download the invoice: the download (the invoice is downloaded, the format).
2. Verify the download is generated in the selected format.
3. Verify the downloaded invoice matches the invoice view.
**Expected Result:** The invoice is downloaded — the invoice in the selected format is generated.
**Priority:** Medium

### TC-SA-15-04-013 — Invoice record: the record (the invoice, the date, the amount, the status); the record is the proof
**Type:** Positive
**Covers:** 4.2 → Invoice record: the record (the invoice, the date, the amount, the status)
**Preconditions:** Invoices exist.
**Steps:**
1. Open the invoice record.
2. Verify it shows the invoice, the date, the amount, and the status.
**Expected Result:** The invoice is recorded — the invoice, the date, the amount, and the status are shown.
**Priority:** High

### TC-SA-15-04-014 — Invoice retrieval is audit-logged with the invoice, filter, and timestamp
**Type:** Positive
**Covers:** 4.2 → Audit logging of the invoice retrieval; Rule: invoice retrieval is audit-logged with the invoice, filter, and timestamp
**Preconditions:** Invoice retrieval has occurred with filters.
**Steps:**
1. Open the audit trail and filter by "invoice retrieval".
2. Verify entries show the invoice, the filter, and the timestamp.
**Expected Result:** The invoice retrieval is audit-logged with the invoice, filter, and timestamp.
**Priority:** Critical

## 4.3 Branded Invoices for Institutes

### TC-SA-15-04-015 — Institute branding: the branding (the institute's branding, the logo, the colors, the name); the branding is the mark
**Type:** Positive
**Covers:** 4.3 → Institute branding: the branding (the institute's branding, the logo, the colors, the name); Rule: the institute branding is the identity (the institute's branding, the logo, the colors, the name); the branding is the mark
**Preconditions:** An institute exists.
**Steps:**
1. Set the institute branding: the branding (the institute's branding, the logo, the colors, the name).
2. Verify the branding is the identity and is saved.
**Expected Result:** The institute branding is set — the institute's branding (the logo, the colors, the name) is the mark.
**Priority:** High

### TC-SA-15-04-016 — Branded invoice: the invoice (the invoice, the branding, the items, the amount); the invoice is the proof
**Type:** Positive
**Covers:** 4.3 → Branded invoice: the invoice (the invoice, the branding, the items, the amount); Rule: the branded invoice is the document (the invoice, the branding, the items, the amount); the invoice is the proof
**Preconditions:** Institute branding is configured.
**Steps:**
1. Set the branded invoice: the invoice (the invoice, the branding, the items, the amount).
2. Verify the invoice is the document and is saved.
**Expected Result:** The branded invoice is set — the invoice, the branding, the items, and the amount are the document.
**Priority:** High

### TC-SA-15-04-017 — Branding configuration: the configuration (the institute, the branding, the invoice); the configuration is the setup
**Type:** Positive
**Covers:** 4.3 → Branding configuration: the configuration (the institute, the branding, the invoice); Rule: the branding configuration is the control (the institute, the branding, the invoice); the configuration is the setup
**Preconditions:** Super Admin is logged in.
**Steps:**
1. Configure the branded invoice: the institute (the institute, the name), the branding (the institute's branding, the logo, the colors, the name), and the invoice (the invoice, the items, the amount).
2. Save; verify the branded invoice is live and the invoices are generated with the branding.
**Expected Result:** The branding configuration is saved — the institute, the branding, and the invoice are configured and live.
**Priority:** Critical

### TC-SA-15-04-018 — Invoice generation: the generation (the invoice is generated with the branding); the invoice is recorded
**Type:** Positive
**Covers:** 4.3 → Invoice generation: the generation (the invoice is generated with the branding)
**Preconditions:** Branded invoice configuration is live; an invoice is generated for the institute.
**Steps:**
1. An invoice is generated for the institute — verify the branding is applied (the logo, the colors, the name are on the invoice).
2. Verify the invoice is recorded.
**Expected Result:** The branded invoice is generated — the branding (the logo, the colors, the name) is applied to the invoice.
**Priority:** Critical

### TC-SA-15-04-019 — Invoice record: the record (the invoice, the branding, the items, the amount, the date); the record is the proof
**Type:** Positive
**Covers:** 4.3 → Invoice record: the record (the invoice, the branding, the items, the amount, the date)
**Preconditions:** A branded invoice has been generated.
**Steps:**
1. Open the invoice record.
2. Verify it shows the invoice, the branding, the items, the amount, and the date.
**Expected Result:** The branded invoice is recorded — the invoice, the branding, the items, the amount, and the date are shown.
**Priority:** High

### TC-SA-15-04-020 — Invoice view: the view (the invoices, the institutes, the period); the generation is managed
**Type:** Positive
**Covers:** 4.3 → Invoice view: the view (the invoices, the institutes, the period); Rule: the branded invoices are visible (the invoices, the institutes, the period); the generation is managed
**Preconditions:** Branded invoices have been generated for multiple institutes.
**Steps:**
1. View the branded invoices: the invoices, the institutes, the period — verify the invoices are visible.
2. Verify the view is complete for the period.
**Expected Result:** The invoice view works — the branded invoices for the institutes and the period are visible.
**Priority:** High

### TC-SA-15-04-021 — Branded invoice generation is audit-logged with the institute, branding, and timestamp
**Type:** Positive
**Covers:** 4.3 → Audit logging of the branded invoice generation; Rule: a branding change (the logo, the colors, the name updated) is recorded (the new logo, the new colors, the new name, the time); it is auditable; Rule: branded invoice generation is audit-logged with the institute, branding, and timestamp
**Preconditions:** Branded invoices have been generated and the branding has been changed.
**Steps:**
1. Open the audit trail and filter by "branded invoice".
2. Verify entries show the institute, the branding, and the timestamp for the generation.
3. Verify the branding change (the new logo, the new colors, the new name, the time) is recorded and auditable.
**Expected Result:** The branded invoice generation is audit-logged with the institute, branding, and timestamp.
**Priority:** Critical
