- Introduced Technician Dashboard V1 (tech_v1_overview.html) with KPI cards and new cases overview. - Implemented Technician Dashboard V2 (tech_v2_workboard.html) featuring a workboard layout for daily tasks and opportunities. - Developed Technician Dashboard V3 (tech_v3_table_focus.html) with a power table for detailed case management. - Created a dashboard selector page (technician_dashboard_selector.html) for easy navigation between dashboard versions. - Added user dashboard preferences migration (130_user_dashboard_preferences.sql) to store default dashboard paths. - Enhanced sag_sager table with assigned group ID (131_sag_assignment_group.sql) for better case management. - Updated sag_subscriptions table to include cancellation rules and billing dates (132_subscription_cancellation.sql, 134_subscription_billing_dates.sql). - Implemented subscription staging for CRM integration (136_simply_subscription_staging.sql). - Added a script to move time tracking section in detail view (move_time_section.py). - Created a test script for subscription processing (test_subscription_processing.py).
23 lines
975 B
SQL
23 lines
975 B
SQL
-- Migration 134: Add billing period tracking to subscriptions
|
|
-- Adds next_invoice_date and period_start fields for tracking billing cycles
|
|
|
|
ALTER TABLE sag_subscriptions
|
|
ADD COLUMN IF NOT EXISTS next_invoice_date DATE,
|
|
ADD COLUMN IF NOT EXISTS period_start DATE;
|
|
|
|
-- Set default values for existing subscriptions
|
|
UPDATE sag_subscriptions
|
|
SET
|
|
next_invoice_date = start_date + INTERVAL '1 month',
|
|
period_start = start_date
|
|
WHERE next_invoice_date IS NULL AND status = 'active';
|
|
|
|
-- Create index for efficient querying of subscriptions due for invoicing
|
|
CREATE INDEX IF NOT EXISTS idx_sag_subscriptions_next_invoice
|
|
ON sag_subscriptions(next_invoice_date)
|
|
WHERE status = 'active';
|
|
|
|
COMMENT ON COLUMN sag_subscriptions.next_invoice_date IS 'Next date when an invoice should be generated for this subscription';
|
|
COMMENT ON COLUMN sag_subscriptions.period_start IS 'Start date of the current billing period - shifts to next period when invoice is generated';
|
|
|