feat: debit note (#9)
* fix: filter not work * feat: add debit note flag to quotation * feat: add debit note structure * refactor: change name to debit * refactor(quotation): only query quotation not debit note * feat: delete debit note * feat: get debit note by id * chore: add import * feat: debit note stats * feat: get debit note list * chore: add comment * refactor: add debit note filter to invoice * chore: migration * refactor: change attachment endpoint to explicit declare * add createDebitNote * feat: add quotation relation to get endpoint * fix: wrong query * fix data to create * feat: include debit note in relation * feat: handle delete file on delete data * feat: check if quotation exists * feat: add update payload * refactor: merge variable * feat: add update endpoint debit note * fix: quotation is not flagged as debit note * feat: add worker into debit note * feat: add update debit note with worker * fix: missing remark field * feat: auto invoice This commit automatically create debit note invoice and payment data. Debit note does not required to create invoice and do not have installments. * feat: set default get invoice param to only quotation * refactor: debit note param in payment/invoice * fixup! refactor: debit note param in payment/invoice * fix: product does not have any worker --------- Co-authored-by: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Co-authored-by: Kanjana <taii.kanjana@gmail.com>
This commit is contained in:
parent
5fe6ce1d5c
commit
67651eb213
7 changed files with 951 additions and 23 deletions
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the `DebitNote` table. If the table is not empty, all the data it contains will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "DebitNote" DROP CONSTRAINT "DebitNote_quotationId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Quotation" ADD COLUMN "debitNoteQuotationId" TEXT,
|
||||
ADD COLUMN "isDebitNote" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- DropTable
|
||||
DROP TABLE "DebitNote";
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Quotation" ADD CONSTRAINT "Quotation_debitNoteQuotationId_fkey" FOREIGN KEY ("debitNoteQuotationId") REFERENCES "Quotation"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
|
@ -1277,6 +1277,11 @@ model Quotation {
|
|||
discount Float @default(0)
|
||||
finalPrice Float
|
||||
|
||||
isDebitNote Boolean @default(false)
|
||||
debitNoteQuotationId String?
|
||||
debitNoteQuotation Quotation? @relation(name: "QuotationDebitNote", fields: [debitNoteQuotationId], references: [id])
|
||||
debitNote Quotation[] @relation(name: "QuotationDebitNote")
|
||||
|
||||
requestData RequestData[]
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
|
|
@ -1288,7 +1293,6 @@ model Quotation {
|
|||
|
||||
invoice Invoice[]
|
||||
creditNote CreditNote[]
|
||||
debitNote DebitNote[]
|
||||
}
|
||||
|
||||
model QuotationPaySplit {
|
||||
|
|
@ -1625,12 +1629,3 @@ model CreditNote {
|
|||
createdBy User? @relation(name: "CreditNoteCreatedByUser", fields: [createdByUserId], references: [id])
|
||||
createdByUserId String?
|
||||
}
|
||||
|
||||
model DebitNote {
|
||||
id String @id @default(cuid())
|
||||
|
||||
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
|
||||
quotationId String
|
||||
|
||||
// NOTE: create quotation but with flag debit note?
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue