Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Recurring Transactions Support for Invoices and Expenses #385

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented Dec 24, 2024

This pull request was created by Sweep to resolve the following request by @curtisdelicata:

Description: Add the ability to create recurring invoices and expenses.

Tasks:
Modify Invoice and Expense models to support recurring entries.
Create a UI for setting recurrence frequency.
Schedule recurring transactions via job scheduling.
Acceptance Criteria:
Users can create recurring transactions.
Recurring transactions are automatically processed.

Continue chatting at https://sweep-chat-demo.vercel.app/c/654171fb-cc52-4241-b4d6-35c9a92e0c14.

Purpose

Implement a comprehensive recurring transactions feature for invoices and expenses, allowing automatic generation of recurring financial documents based on predefined schedules.

Description

This pull request introduces a robust recurring transactions system for both invoices and expenses in the Liberu Accounting application. The implementation includes:

  1. Database Migration: Added new fields to invoices and expenses tables to support recurring transaction logic, including:

    • is_recurring boolean flag
    • recurrence_frequency to define repeat interval
    • recurrence_start and recurrence_end dates
    • last_generated to track the most recent transaction generation
  2. Model Enhancements:

    • Added generateRecurring() method to both Invoice and Expense models
    • Implemented logic to create new transactions based on recurrence rules
    • Added validation to prevent generating transactions beyond the end date
  3. Filament Resource Updates:

    • Added form fields for recurring transaction configuration
    • Implemented dynamic form visibility based on recurring toggle
    • Provided frequency and date range selection options
  4. Scheduled Task Integration:

    • Created ProcessRecurringTransactions console command
    • Configured daily scheduling in Kernel.php to automatically process recurring transactions

Summary

  • Added support for recurring Invoices and Expenses
  • Created database migrations for is_recurring fields
  • Implemented generateRecurring() methods in Invoice and Expense models
  • Updated Filament resources with recurring transaction form fields
  • Added console command and scheduler for automatic transaction generation
  • Supported frequencies: daily, weekly, monthly, yearly

@curtisdelicata curtisdelicata merged commit cdbf42d into main Dec 24, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant