-- V71: payment 테이블 세무 컬럼 누락 보강
-- V23 세무처리.sql 체크섬 미스매치로 income_tax_amount 등 미적용 → idempotent 추가

ALTER TABLE payment
    ADD COLUMN IF NOT EXISTS income_tax_amount NUMERIC(15,2) NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS local_tax_amount  NUMERIC(15,2) NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS vat_amount        NUMERIC(15,2) NOT NULL DEFAULT 0,
    ADD COLUMN IF NOT EXISTS net_amount        NUMERIC(15,2);

COMMENT ON COLUMN payment.income_tax_amount IS '원천세 (소득세 3%)';
COMMENT ON COLUMN payment.local_tax_amount  IS '지방소득세 (소득세의 10%)';
COMMENT ON COLUMN payment.vat_amount        IS '부가세';
COMMENT ON COLUMN payment.net_amount        IS '실수령액 (pay_amount - income_tax - local_tax)';
