Files
itflow/agent/modals/recurring_expense/recurring_expense_edit.php
johnnyq 94413424e4 Expenses stage 2: recurring expenses on a real schedule - monthly, quarterly or yearly on the day of the month they started on with the 31st falling back to a shorter month's last day, an optional end date for leases and financing after which they stop by themselves, the nightly run recording each one due today or missed by up to 7 nights dated the day it was due and telling the team about each with a link to it, one notice the day one falls too far behind in place of the nightly nag, Record Now dated today when early or the due date when late and safe to press twice, Move On to skip missed runs, Pause and Resume, a rebuilt list with cost a month, the next 30 days, running and need a look along the top, Active, Next 7 days, Late, Paused, Ended and All pills and vendor, category and client filters, a quick look with the schedule in words, the next dates, this year's total and the expenses it recorded, one New and Edit form that says the schedule as it is set and fills in from the vendor's last expense, recorded expenses carrying the payment method and reference and linked back with a filter and icon on the expenses list and a Recorded by line in their quick look, the dashboard figure, cash flow forecast and expense, recurring revenue and spend by vendor reports counting quarterly ones and end dates, the vendor page opening the quick look, demo data standing costs on their own days with insurance quarterly and linked to their history, fixes for edits moving the next date, new monthly ones starting in the picked month, recorded expenses losing the payment method, no way to pause and the list's date filter using the creation date, delete now needing full financial access, database 3.0.0 with frequency as month, quarter or year, anchor day and end date, the old day and month columns dropped and expense_recurring_expense_id backfilled, CHANGELOG updated
2026-10-16 18:02:00 -04:00

43 lines
1.9 KiB
PHP

<?php
/*
* Edit a recurring expense - everything, and its schedule. Moving the next
* date moves the day of the month it runs on with it. The expenses it has
* already recorded don't change.
*/
require_once '../../../includes/modal_header.php';
enforceUserPermission('module_financial', 2);
$form_row = recurringExpenseRow(intval($_GET['id'] ?? 0));
if (!$form_row) {
echo json_encode(['error' => 'That recurring expense no longer exists.']);
exit;
}
ob_start();
?>
<div class="modal-header bg-dark">
<h5 class="modal-title text-truncate"><i class="fas fa-fw fa-edit me-2"></i>Edit Recurring Expense <span class="fw-normal text-white-50 ms-1"><?= escapeHtml(recurringExpenseLabel($form_row)) ?></span></h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="recurring_expense_id" value="<?= intval($form_row['recurring_expense_id']) ?>">
<div class="modal-body">
<?php require __DIR__ . '/recurring_expense_form.php'; ?>
<?php if (intval($form_row['made_count'])) { ?>
<div class="form-text mt-3"><i class="fas fa-info-circle me-1"></i>The <?= intval($form_row['made_count']) ?> expense<?= intval($form_row['made_count']) === 1 ? '' : 's' ?> it has recorded keep their amounts - only the ones to come change.</div>
<?php } ?>
</div>
<div class="modal-footer">
<button type="submit" name="edit_recurring_expense" class="btn btn-primary text-bold"><i class="fas fa-check me-2"></i>Save</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fas fa-times me-2"></i>Cancel</button>
</div>
</form>
<?php
require_once '../../../includes/modal_footer.php';