feat: add invoice builder with line detail, address, and person picker.
Enrich invoice line items and previews, migrate several CRM surfaces to Ant, and wire shared money/picker helpers.
This commit is contained in:
@@ -1357,6 +1357,8 @@ model Invoice {
|
||||
kind String @default("invoice") // invoice | credit
|
||||
currency String @default("IRR")
|
||||
notes String?
|
||||
/// آدرس صورتحساب / ارسال
|
||||
address String?
|
||||
discountAmount Decimal @default(0) @db.Decimal(18, 2)
|
||||
taxPercent Decimal @default(0) @db.Decimal(8, 2)
|
||||
issuedAt DateTime?
|
||||
@@ -1393,18 +1395,22 @@ model Invoice {
|
||||
}
|
||||
|
||||
model InvoiceLineItem {
|
||||
id String @id @default(cuid())
|
||||
invoiceId String
|
||||
invoice Invoice @relation(fields: [invoiceId], references: [id], onDelete: Cascade)
|
||||
productId String?
|
||||
product Product? @relation(fields: [productId], references: [id], onDelete: SetNull)
|
||||
name String
|
||||
quantity Decimal @default(1) @db.Decimal(18, 2)
|
||||
unitPrice Decimal @db.Decimal(18, 2)
|
||||
currency String @default("IRR")
|
||||
position Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(cuid())
|
||||
invoiceId String
|
||||
invoice Invoice @relation(fields: [invoiceId], references: [id], onDelete: Cascade)
|
||||
productId String?
|
||||
product Product? @relation(fields: [productId], references: [id], onDelete: SetNull)
|
||||
name String
|
||||
unit String?
|
||||
description String?
|
||||
quantity Decimal @default(1) @db.Decimal(18, 2)
|
||||
unitPrice Decimal @db.Decimal(18, 2)
|
||||
discountAmount Decimal @default(0) @db.Decimal(18, 2)
|
||||
taxPercent Decimal @default(0) @db.Decimal(8, 2)
|
||||
currency String @default("IRR")
|
||||
position Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([invoiceId, position])
|
||||
@@index([productId])
|
||||
|
||||
Reference in New Issue
Block a user