-- Add TDS and adjustment fields to purchase_orders

ALTER TABLE purchase_orders
  ADD COLUMN IF NOT EXISTS tds_applicable BOOLEAN NOT NULL DEFAULT false,
  ADD COLUMN IF NOT EXISTS tds_section_pct NUMERIC(5, 2),
  ADD COLUMN IF NOT EXISTS tds_amount NUMERIC(15, 4) NOT NULL DEFAULT 0,
  ADD COLUMN IF NOT EXISTS adjustment NUMERIC(15, 4) NOT NULL DEFAULT 0;

COMMENT ON COLUMN purchase_orders.tds_applicable IS 'Whether TDS is applicable on this PO';
COMMENT ON COLUMN purchase_orders.tds_section_pct IS 'TDS percentage when tds_applicable is true';
COMMENT ON COLUMN purchase_orders.tds_amount IS 'Computed TDS amount deducted from grand total';
COMMENT ON COLUMN purchase_orders.adjustment IS 'Manual +/- amount adjustment applied to grand total';
