This commit is contained in:
2026-07-23 18:13:25 +03:30
parent 8cd855827d
commit 3314113e7a
11 changed files with 92 additions and 39 deletions
@@ -15,7 +15,7 @@ export class Migration20260626140000 extends Migration {
v_total int;
v_paid int;
v_enable_tax boolean;
v_confirm_status text;
v_status text;
BEGIN
v_invoice_id := COALESCE(NEW.invoice_id, OLD.invoice_id);
@@ -68,7 +68,7 @@ export class Migration20260626140000 extends Migration {
) THEN 'confirmed'
ELSE 'partially_confirmed'
END
INTO v_confirm_status;
INTO v_status;
UPDATE invoices
SET
@@ -78,8 +78,9 @@ export class Migration20260626140000 extends Migration {
total = v_total,
paid_amount = v_paid,
balance = v_total - v_paid,
confirm_status = v_confirm_status
WHERE id = v_invoice_id;
status = v_status
WHERE id = v_invoice_id
AND status <> 'archived';
RETURN NULL;
END;