49 lines
1.8 KiB
Plaintext
49 lines
1.8 KiB
Plaintext
|
|
model SalesInvoice {
|
||
|
|
id Int @id @default(autoincrement())
|
||
|
|
code String @unique @db.VarChar(100)
|
||
|
|
totalAmount Decimal @db.Decimal(15, 2)
|
||
|
|
description String? @db.Text
|
||
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||
|
|
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
||
|
|
customerId Int?
|
||
|
|
posAccountId Int
|
||
|
|
customer Customer? @relation(fields: [customerId], references: [id])
|
||
|
|
posAccount PosAccount @relation(fields: [posAccountId], references: [id])
|
||
|
|
items SalesInvoiceItem[]
|
||
|
|
salesInvoicePayments SalesInvoicePayment[]
|
||
|
|
|
||
|
|
@@index([customerId])
|
||
|
|
@@index([posAccountId])
|
||
|
|
@@map("Sales_Invoices")
|
||
|
|
}
|
||
|
|
|
||
|
|
model SalesInvoiceItem {
|
||
|
|
id Int @id @default(autoincrement())
|
||
|
|
count Decimal @db.Decimal(10, 0)
|
||
|
|
unitPrice Decimal @default(0.00) @db.Decimal(15, 2)
|
||
|
|
totalAmount Decimal @default(0.00) @db.Decimal(15, 2)
|
||
|
|
createdAt DateTime @default(now()) @db.Timestamp(0)
|
||
|
|
invoiceId Int
|
||
|
|
productId Int
|
||
|
|
invoice SalesInvoice @relation(fields: [invoiceId], references: [id])
|
||
|
|
product Product @relation(fields: [productId], references: [id])
|
||
|
|
|
||
|
|
@@index([invoiceId])
|
||
|
|
@@index([productId])
|
||
|
|
@@map("Sales_Invoice_Items")
|
||
|
|
}
|
||
|
|
|
||
|
|
model SalesInvoicePayment {
|
||
|
|
id Int @id @default(autoincrement())
|
||
|
|
invoiceId Int
|
||
|
|
amount Decimal @db.Decimal(15, 2)
|
||
|
|
paymentMethod PaymentMethodType
|
||
|
|
paidAt DateTime
|
||
|
|
createdAt DateTime @default(now())
|
||
|
|
|
||
|
|
invoice SalesInvoice @relation(fields: [invoiceId], references: [id])
|
||
|
|
|
||
|
|
@@index([invoiceId])
|
||
|
|
@@map("Sales_Invoice_Payments")
|
||
|
|
}
|