Initial commit: FunZone accounting frontend with Sepidar-inspired RTL modules
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
155
src/types/index.ts
Normal file
155
src/types/index.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
export type ID = string
|
||||
|
||||
export type AccountType = 'asset' | 'liability' | 'equity' | 'income' | 'expense'
|
||||
|
||||
export interface Account {
|
||||
id: ID
|
||||
code: string
|
||||
name: string
|
||||
type: AccountType
|
||||
parentId: ID | null
|
||||
isGroup: boolean
|
||||
openingBalance: number
|
||||
}
|
||||
|
||||
export interface VoucherLine {
|
||||
id: ID
|
||||
accountId: ID
|
||||
description: string
|
||||
debit: number
|
||||
credit: number
|
||||
}
|
||||
|
||||
export type VoucherStatus = 'draft' | 'posted'
|
||||
|
||||
export interface Voucher {
|
||||
id: ID
|
||||
number: number
|
||||
date: string
|
||||
description: string
|
||||
status: VoucherStatus
|
||||
lines: VoucherLine[]
|
||||
/** Set when the voucher was generated automatically by another module. */
|
||||
source?: string
|
||||
}
|
||||
|
||||
export type PartyKind = 'customer' | 'supplier'
|
||||
|
||||
export interface Party {
|
||||
id: ID
|
||||
kind: PartyKind
|
||||
name: string
|
||||
phone: string
|
||||
economicCode: string
|
||||
address: string
|
||||
openingBalance: number
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
id: ID
|
||||
code: string
|
||||
name: string
|
||||
unit: string
|
||||
salePrice: number
|
||||
purchasePrice: number
|
||||
stock: number
|
||||
reorderLevel: number
|
||||
}
|
||||
|
||||
export interface InvoiceLine {
|
||||
id: ID
|
||||
productId: ID
|
||||
quantity: number
|
||||
unitPrice: number
|
||||
discount: number
|
||||
taxRate: number
|
||||
}
|
||||
|
||||
export type InvoiceKind = 'sale' | 'purchase'
|
||||
export type InvoiceStatus = 'draft' | 'confirmed' | 'paid'
|
||||
|
||||
export interface Invoice {
|
||||
id: ID
|
||||
kind: InvoiceKind
|
||||
number: number
|
||||
partyId: ID
|
||||
date: string
|
||||
status: InvoiceStatus
|
||||
note: string
|
||||
lines: InvoiceLine[]
|
||||
}
|
||||
|
||||
export type TreasuryKind = 'receipt' | 'payment'
|
||||
export type TreasuryMethod = 'cash' | 'bank' | 'cheque'
|
||||
|
||||
export interface TreasuryTxn {
|
||||
id: ID
|
||||
number: number
|
||||
kind: TreasuryKind
|
||||
method: TreasuryMethod
|
||||
date: string
|
||||
partyId: ID | null
|
||||
amount: number
|
||||
reference: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface Employee {
|
||||
id: ID
|
||||
code: string
|
||||
name: string
|
||||
position: string
|
||||
baseSalary: number
|
||||
insuranceNo: string
|
||||
hireDate: string
|
||||
active: boolean
|
||||
}
|
||||
|
||||
export interface Payslip {
|
||||
id: ID
|
||||
employeeId: ID
|
||||
period: string
|
||||
baseSalary: number
|
||||
overtime: number
|
||||
bonus: number
|
||||
deductions: number
|
||||
insurance: number
|
||||
tax: number
|
||||
}
|
||||
|
||||
/** Account mapping used to auto-generate journal vouchers from live FunZone data. */
|
||||
export interface VoucherAccountMap {
|
||||
/** Cash/bank settlement account (debit on inflow, credit on outflow). */
|
||||
bankAccountId: ID
|
||||
/** Liability owed to venue owners (their wallet balance). */
|
||||
ownerPayableAccountId: ID
|
||||
/** Liability owed to customers (their wallet balance). */
|
||||
customerPayableAccountId: ID
|
||||
/** Expense recognising the owner's share of a booking. */
|
||||
ownerShareAccountId: ID
|
||||
/** Income account for reservation/ticket sales. */
|
||||
salesIncomeAccountId: ID
|
||||
}
|
||||
|
||||
export interface CompanySettings {
|
||||
name: string
|
||||
economicCode: string
|
||||
fiscalYear: string
|
||||
baseCurrency: string
|
||||
taxRate: number
|
||||
address: string
|
||||
phone: string
|
||||
voucherAccounts: VoucherAccountMap
|
||||
}
|
||||
|
||||
export interface AppData {
|
||||
accounts: Account[]
|
||||
vouchers: Voucher[]
|
||||
parties: Party[]
|
||||
products: Product[]
|
||||
invoices: Invoice[]
|
||||
treasury: TreasuryTxn[]
|
||||
employees: Employee[]
|
||||
payslips: Payslip[]
|
||||
settings: CompanySettings
|
||||
}
|
||||
Reference in New Issue
Block a user