- Added views for listing fixed-price agreements, displaying agreement details, and a reporting dashboard. - Created HTML templates for listing, detailing, and reporting on fixed-price agreements. - Introduced API endpoint to fetch active customers for agreement creation. - Added migration scripts for creating necessary database tables and views for fixed-price agreements, billing periods, and reporting. - Implemented triggers for auto-generating agreement numbers and updating timestamps. - Enhanced ticket management with archived ticket views and filtering capabilities.
23 lines
963 B
SQL
23 lines
963 B
SQL
-- Migration 101: Add fixed_price_agreement_id to time tracking tables
|
|
-- Links time entries to fixed-price agreements for billing and reporting
|
|
|
|
-- Add to ticket worklog
|
|
ALTER TABLE tticket_worklog
|
|
ADD COLUMN IF NOT EXISTS fixed_price_agreement_id INTEGER
|
|
REFERENCES customer_fixed_price_agreements(id) ON DELETE SET NULL;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_worklog_fpa ON tticket_worklog(fixed_price_agreement_id);
|
|
|
|
-- Add to sag/solutions time tracking
|
|
ALTER TABLE tmodule_times
|
|
ADD COLUMN IF NOT EXISTS fixed_price_agreement_id INTEGER
|
|
REFERENCES customer_fixed_price_agreements(id) ON DELETE SET NULL;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_times_fpa ON tmodule_times(fixed_price_agreement_id);
|
|
|
|
COMMENT ON COLUMN tticket_worklog.fixed_price_agreement_id IS
|
|
'Links worklog entry to fixed-price agreement for billing tracking';
|
|
|
|
COMMENT ON COLUMN tmodule_times.fixed_price_agreement_id IS
|
|
'Links time entry to fixed-price agreement for billing tracking';
|