mirror of https://github.com/itflow-org/itflow
Set Invoice Credit, Consolidated all expense modals to modals/expense removed ajax_ and _modal prefixes from file name create new modal header and footer to include another parent directory eventually will consolidate all, this was just an example
This commit is contained in:
parent
7f49ecefb1
commit
6ccf7a0fb8
|
|
@ -0,0 +1,10 @@
|
|||
<script src="../../../js/app.js"></script>
|
||||
<script src="../../../plugins/Show-Hide-Passwords-Bootstrap-4/bootstrap-show-password.min.js"></script>
|
||||
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
|
||||
// Return the title and content as a JSON response
|
||||
echo json_encode(['content' => $content]);
|
||||
exit();
|
||||
?>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
require_once "../../../config.php";
|
||||
require_once "../../../functions.php";
|
||||
require_once "../../../includes/check_login.php";
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Check for the 'id' parameter
|
||||
//if (!isset($_GET['id'])) {
|
||||
// echo json_encode(['error' => 'ID missing.']);
|
||||
// exit;
|
||||
//}
|
||||
|
|
@ -305,11 +305,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</td>
|
||||
<td>
|
||||
<?php echo $receipt_attached; ?>
|
||||
<a class="text-dark" href="#" title="Created: <?php echo $expense_created_at; ?>"
|
||||
data-toggle="ajax-modal"
|
||||
<a class="text-dark ajax-modal" href="#" title="Created: <?php echo $expense_created_at; ?>"
|
||||
data-modal-size="lg"
|
||||
data-ajax-url="ajax/ajax_expense_edit.php"
|
||||
data-ajax-id="<?php echo $expense_id; ?>">
|
||||
data-modal-url="modals/expense/expense_edit.php?id=<?= $expense_id ?>">
|
||||
<?php echo $expense_date; ?>
|
||||
</a>
|
||||
</td>
|
||||
|
|
@ -334,26 +332,20 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-size="lg"
|
||||
data-ajax-url="ajax/ajax_expense_edit.php"
|
||||
data-ajax-id="<?php echo $expense_id; ?>">
|
||||
data-modal-url="modals/expense/expense_edit.php?id=<?= $expense_id ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-size="lg"
|
||||
data-ajax-url="ajax/ajax_expense_copy.php"
|
||||
data-ajax-id="<?php echo $expense_id; ?>">
|
||||
data-modal-url="modals/expense/expense_copy.php?id=<?= $expense_id ?>">
|
||||
<i class="fas fa-fw fa-copy mr-2"></i>Copy
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#"
|
||||
data-toggle="ajax-modal"
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-size="lg"
|
||||
data-ajax-url="ajax/ajax_expense_refund.php"
|
||||
data-ajax-id="<?php echo $expense_id; ?>">
|
||||
data-modal-url="modals/expense/expense_refund.php?id=<?= $expense_id ?>">
|
||||
<i class="fas fa-fw fa-undo-alt mr-2"></i>Refund
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
@ -372,9 +364,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "modals/expense_bulk_edit_category_modal.php"; ?>
|
||||
<?php require_once "modals/expense_bulk_edit_account_modal.php"; ?>
|
||||
<?php require_once "modals/expense_bulk_edit_client_modal.php"; ?>
|
||||
<?php require_once "modals/expense/expense_bulk_edit_category.php"; ?>
|
||||
<?php require_once "modals/expense/expense_bulk_edit_account.php"; ?>
|
||||
<?php require_once "modals/expense/expense_bulk_edit_client.php"; ?>
|
||||
</form>
|
||||
<?php require_once "../includes/filter_footer.php";
|
||||
?>
|
||||
|
|
@ -384,7 +376,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||
<script src="../js/bulk_actions.js"></script>
|
||||
|
||||
<?php
|
||||
require_once "modals/expense_add_modal.php";
|
||||
require_once "modals/expense_export_modal.php";
|
||||
require_once "modals/expense/expense_add.php";
|
||||
require_once "modals/expense/expense_export.php";
|
||||
|
||||
require_once "../includes/footer.php";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once '../../includes/modal_header.php';
|
||||
require_once '../../../includes/modal_header_new.php';
|
||||
|
||||
$expense_id = intval($_GET['id']);
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ ob_start();
|
|||
|
||||
<?php
|
||||
|
||||
require_once '../../includes/modal_footer.php';
|
||||
require_once '../../../includes/modal_footer_new.php';
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once '../../includes/modal_header.php';
|
||||
require_once '../../../includes/modal_header_new.php';
|
||||
|
||||
$expense_id = intval($_GET['id']);
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ ob_start();
|
|||
|
||||
<?php
|
||||
|
||||
require_once '../../includes/modal_footer.php';
|
||||
require_once '../../../includes/modal_footer_new.php';
|
||||
|
||||
?>
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
require_once '../../includes/modal_header.php';
|
||||
require_once '../../../includes/modal_header_new.php';
|
||||
|
||||
$expense_id = intval($_GET['id']);
|
||||
|
||||
|
|
@ -88,7 +88,5 @@ ob_start();
|
|||
|
||||
<?php
|
||||
|
||||
require_once '../../includes/modal_footer.php';
|
||||
|
||||
?>
|
||||
require_once '../../../includes/modal_footer_new.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");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue