FEATURE: New Invoice Status Non-Billable

This commit is contained in:
johnnyq 2024-10-25 14:33:12 -04:00
parent 58f995ed37
commit ae561d3195
3 changed files with 26 additions and 2 deletions

View File

@ -438,6 +438,7 @@ if ($config_send_invoice_reminders == 1) {
WHERE invoice_status != 'Draft'
AND invoice_status != 'Paid'
AND invoice_status != 'Cancelled'
AND invoice_status != 'Non-Billable'
AND DATE_ADD(invoice_due, INTERVAL $day DAY) = CURDATE()
ORDER BY invoice_number DESC"
);

View File

@ -159,7 +159,7 @@ if (isset($_GET['invoice_id'])) {
<div class="row">
<div class="col-8">
<?php if ($invoice_status == 'Draft' && $invoice_amount != 0) { ?>
<?php if ($invoice_status == 'Draft') { ?>
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-fw fa-paper-plane mr-2"></i>Send
</button>
@ -181,6 +181,13 @@ if (isset($_GET['invoice_id'])) {
<i class="fa fa-fw fa-credit-card mr-2"></i>Add Payment
</a>
<?php } ?>
<?php if (($invoice_status == 'Sent' || $invoice_status == 'Viewed') && $invoice_amount == 0 && $invoice_status !== 'Non-Billable') { ?>
<a class="btn btn-dark" href="post.php?mark_invoice_non-billable=<?php echo $invoice_id; ?>">
Mark Non-Billable
</a>
<?php } ?>
</div>
<div class="col-4">
@ -238,7 +245,7 @@ if (isset($_GET['invoice_id'])) {
<div class="col-sm-10">
<div class="ribbon-wrapper">
<div class="ribbon bg-<?php echo $invoice_badge_color; ?>">
<?php echo $invoice_status; ?>
<?php echo "$invoice_status"; ?>
</div>
</div>
<h3 class="text-right mt-5"><strong>Invoice</strong><br><small class="text-secondary"><?php echo "$invoice_prefix$invoice_number"; ?></small></h3>

View File

@ -373,6 +373,22 @@ if (isset($_GET['mark_invoice_sent'])) {
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if (isset($_GET['mark_invoice_non-billable'])) {
$invoice_id = intval($_GET['mark_invoice_non-billable']);
mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Non-Billable' WHERE invoice_id = $invoice_id");
mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Non-Billable', history_description = 'INVOICE marked Non-Billable', history_invoice_id = $invoice_id");
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Invoice', log_action = 'Update', log_description = '$invoice_id marked Non-Billable', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id");
$_SESSION['alert_message'] = "Invoice marked Non-Billable";
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if (isset($_GET['cancel_invoice'])) {