- Backend: FastAPI app with all models, services, schemas, routes - Admin Panel: Next.js dashboard with all modules (CRM, POS, repairs, warranties, billing, notifications, etc.) - Ecommerce: storefront (submodule) + product catalog - AI Agents: .agents/ skill library for Antigravity IDE - Docs: architecture, billing, notification gateway markdown - Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
39 lines
1 KiB
Markdown
39 lines
1 KiB
Markdown
# Invoice Architecture & Tax Calculation
|
|
|
|
## GST Tax Calculation Engine
|
|
|
|
Calculates CGST, SGST, and IGST dynamically based on seller store location vs customer billing address:
|
|
|
|
```text
|
|
IF Seller State == Customer Billing State THEN
|
|
CGST Rate = Total GST Rate / 2 (e.g., 9%)
|
|
SGST Rate = Total GST Rate / 2 (e.g., 9%)
|
|
IGST Rate = 0%
|
|
ELSE
|
|
CGST Rate = 0%
|
|
SGST Rate = 0%
|
|
IGST Rate = Total GST Rate (e.g., 18%)
|
|
END IF
|
|
```
|
|
|
|
---
|
|
|
|
## Shared Online/Offline Invoice Model
|
|
|
|
```sql
|
|
CREATE TABLE invoices (
|
|
invoice_id VARCHAR(26) PRIMARY KEY,
|
|
invoice_no VARCHAR(16) NOT NULL UNIQUE, -- CBIC 16-Char Limit
|
|
order_id VARCHAR(26) NULL,
|
|
pos_transaction_id VARCHAR(26) NULL,
|
|
customer_id VARCHAR(26) NOT NULL,
|
|
subtotal DECIMAL(10,2) NOT NULL,
|
|
discount_amount DECIMAL(10,2) DEFAULT 0.00,
|
|
cgst DECIMAL(10,2) DEFAULT 0.00,
|
|
sgst DECIMAL(10,2) DEFAULT 0.00,
|
|
igst DECIMAL(10,2) DEFAULT 0.00,
|
|
total_amount DECIMAL(10,2) NOT NULL,
|
|
pdf_path VARCHAR(500) NULL,
|
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
```
|