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:
Methapon Metanipat 2025-01-21 10:51:30 +07:00 committed by GitHub
parent 5fe6ce1d5c
commit 67651eb213
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 951 additions and 23 deletions

View file

@ -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;