diff --git a/includes/modal_footer_new.php b/includes/modal_footer_new.php
new file mode 100644
index 00000000..852f792f
--- /dev/null
+++ b/includes/modal_footer_new.php
@@ -0,0 +1,10 @@
+
+
+
+ $content]);
+ exit();
+?>
\ No newline at end of file
diff --git a/includes/modal_header_new.php b/includes/modal_header_new.php
new file mode 100644
index 00000000..695f098a
--- /dev/null
+++ b/includes/modal_header_new.php
@@ -0,0 +1,13 @@
+ 'ID missing.']);
+// exit;
+//}
diff --git a/user/expenses.php b/user/expenses.php
index 484c6756..957e843f 100644
--- a/user/expenses.php
+++ b/user/expenses.php
@@ -305,11 +305,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
+ data-modal-url="modals/expense/expense_edit.php?id== $expense_id ?>">
|
@@ -334,26 +332,20 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
+ data-modal-url="modals/expense/expense_edit.php?id== $expense_id ?>">
Edit
-
+ data-modal-url="modals/expense/expense_copy.php?id== $expense_id ?>">
Copy
-
+ data-modal-url="modals/expense/expense_refund.php?id== $expense_id ?>">
Refund
@@ -372,9 +364,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
-
-
-
+
+
+
@@ -384,7 +376,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
diff --git a/user/ajax/ajax_expense_edit.php b/user/modals/expense/expense_edit.php
similarity index 99%
rename from user/ajax/ajax_expense_edit.php
rename to user/modals/expense/expense_edit.php
index d60ea8ee..9fa98113 100644
--- a/user/ajax/ajax_expense_edit.php
+++ b/user/modals/expense/expense_edit.php
@@ -1,6 +1,6 @@
diff --git a/user/modals/expense_export_modal.php b/user/modals/expense/expense_export.php
similarity index 100%
rename from user/modals/expense_export_modal.php
rename to user/modals/expense/expense_export.php
diff --git a/user/ajax/ajax_expense_refund.php b/user/modals/expense/expense_refund.php
similarity index 97%
rename from user/ajax/ajax_expense_refund.php
rename to user/modals/expense/expense_refund.php
index 4ec75d07..c1169452 100644
--- a/user/ajax/ajax_expense_refund.php
+++ b/user/modals/expense/expense_refund.php
@@ -1,6 +1,6 @@
+require_once '../../../includes/modal_footer_new.php';
diff --git a/user/post/invoice.php b/user/post/invoice.php
index 836f43ea..94df534b 100644
--- a/user/post/invoice.php
+++ b/user/post/invoice.php
@@ -968,6 +968,13 @@ if (isset($_POST['apply_credit'])) {
$invoice_due = $invoice_amount + $total_credit_applied;
$invoice_status = ($invoice_due <= 0) ? 'Paid' : 'Partial';
+ // Update the invoice credit amount
+ mysqli_query($mysqli, "
+ UPDATE invoices
+ SET invoice_credit_amount = $total_credit_applied
+ WHERE invoice_id = $invoice_id
+ ");
+
// Update invoice status only (not invoice_credit_amount)
mysqli_query($mysqli, "UPDATE invoices SET invoice_status = '$invoice_status' WHERE invoice_id = $invoice_id");