mirror of https://github.com/itflow-org/itflow
Added Expense and categories module
This commit is contained in:
parent
cb60f43e60
commit
ab5e4af15b
|
|
@ -0,0 +1,33 @@
|
|||
<div class="modal fade" id="addCategoryModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-plus"></i> New category</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Name</label>
|
||||
<input type="text" class="form-control" name="name" required autofocus="autofocus">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Type</label>
|
||||
<select class="form-control" name="type" required>
|
||||
<option value="">Select a type...</option>
|
||||
<?php foreach($category_types_array as $category_type) { ?>
|
||||
<option><?php echo $category_type; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_category" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -32,7 +32,12 @@
|
|||
<input type="text" class="form-control" name="city" placeholder="City" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<input type="text" class="form-control" name="state" placeholder="State" required>
|
||||
<select class="form-control" name="state" required>
|
||||
<option value="">Select a state...</option>
|
||||
<?php foreach($states_array as $state_abbr => $state_name) { ?>
|
||||
<option value="<?php echo $state_abbr; ?>"><?php echo $state_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<input type="text" class="form-control" name="zip" placeholder="Zip" required>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,118 @@
|
|||
<div class="modal fade" id="addExpenseModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-shopping-cart"></i> New expense</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md">
|
||||
<label>Date</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date" required autofocus="autofocus">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md">
|
||||
<label>Amount</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="number" class="form-control" step="0.01" name="amount" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md">
|
||||
<label>Account</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-university"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="account" required>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM accounts");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$account_id = $row['account_id'];
|
||||
$account_name = $row['account_name'];
|
||||
?>
|
||||
<option value="<?php echo "$account_id"; ?>"><?php echo "$account_name"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md">
|
||||
<label>Vendor</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-briefcase"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="vendor" required>
|
||||
<option value="">- Select Vendor -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM vendors");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
?>
|
||||
<option value="<?php echo "$vendor_id"; ?>"><?php echo "$vendor_name"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-file"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="category" required>
|
||||
<option value="">- Select Category -</option>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Expense'");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$category_id = $row['category_id'];
|
||||
$category_name = $row['category_name'];
|
||||
?>
|
||||
<option value="<?php echo "$category_id"; ?>"><?php echo "$category_name"; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="4" name="description" required></textarea>
|
||||
</div>
|
||||
<div class="custom-file">
|
||||
<input type="file" class="custom-file-input" name="attachment">
|
||||
<label class="custom-file-label">Attach Reciept...</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_expense" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
<?php include("header.php"); ?>
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM categories ORDER BY category_id DESC"); ?>
|
||||
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<button type="button" class="btn btn-primary btn-sm float-right" data-toggle="modal" data-target="#addCategoryModal"><i class="fas fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-borderless table-hover" id="dataTable" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$category_id = $row['category_id'];
|
||||
$category_name = $row['category_name'];
|
||||
$category_type = $row['category_type'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo "$category_name"; ?></td>
|
||||
<td><?php echo "$category_type"; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editcategoryModal<?php echo $category_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
include("edit_category_modal.php");
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("add_category_modal.php"); ?>
|
||||
|
||||
<?php include("footer.php");
|
||||
|
|
@ -26,11 +26,17 @@
|
|||
while($row = mysqli_fetch_array($sql)){
|
||||
$client_id = $row['client_id'];
|
||||
$client_name = $row['client_name'];
|
||||
$client_address = $row['client_address'];
|
||||
$client_city = $row['client_city'];
|
||||
$client_state = $row['client_state'];
|
||||
$client_zip = $row['client_zip'];
|
||||
$client_email = $row['client_email'];
|
||||
$client_phone = $row['client_phone'];
|
||||
if(strlen($client_phone)>2){
|
||||
$client_phone = substr($row['client_phone'],0,3)."-".substr($row['client_phone'],3,3)."-".substr($row['client_phone'],6,4);
|
||||
}
|
||||
$client_website = $row['client_website'];
|
||||
|
||||
|
||||
?>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -80,4 +80,9 @@
|
|||
'US/Pacific'
|
||||
);
|
||||
|
||||
$category_types_array = array(
|
||||
'Expense',
|
||||
'Invoice'
|
||||
);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>" >
|
||||
<div class="form-group">
|
||||
<label>Name</label>
|
||||
<input type="text" class="form-control" name="name" value="<?php echo "$client_name"; ?>" required>
|
||||
|
|
@ -35,7 +36,12 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label>State</label>
|
||||
<input type="text" class="form-control" name="state" value="<?php echo "$client_state"; ?>" required>
|
||||
<select class="form-control" name="state" required>
|
||||
<option value="">Select a state...</option>
|
||||
<?php foreach($states_array as $state_abbr => $state_name) { ?>
|
||||
<option <?php if($client_state == $state_abbr) { echo "selected"; } ?> value="<?php echo $state_abbr; ?>"><?php echo $state_name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Zip</label>
|
||||
|
|
@ -44,7 +50,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="_client" class="btn btn-primary">Save</button>
|
||||
<button type="submit" name="edit_client" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,117 @@
|
|||
<div class="modal fade" id="editExpenseModal<?php echo $expense_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fa fa-edit"></i> Modify expense</h5>
|
||||
<button type="button" class="close" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="expense_id" value="<?php echo $expense_id; ?>">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md">
|
||||
<label>Date</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
<input type="date" class="form-control" name="date" value="<?php echo $expense_date; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md">
|
||||
<label>Amount</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-dollar-sign"></i></span>
|
||||
</div>
|
||||
<input type="number" class="form-control" step="0.01" name="amount" value="<?php echo $expense_amount; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md">
|
||||
<label>Account</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-university"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="account" required>
|
||||
<?php
|
||||
|
||||
$sql2 = mysqli_query($mysqli,"SELECT * FROM accounts");
|
||||
while($row = mysqli_fetch_array($sql2)){
|
||||
$account_id2 = $row['account_id'];
|
||||
$account_name = $row['account_name'];
|
||||
?>
|
||||
<option <?php if($account_id == $account_id2){ ?> selected <?php } ?> value="<?php echo $account_id2; ?>"><?php echo $account_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md">
|
||||
<label>Vendor</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-briefcase"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="vendor" required>
|
||||
<?php
|
||||
|
||||
$sql2 = mysqli_query($mysqli,"SELECT * FROM vendors");
|
||||
while($row = mysqli_fetch_array($sql2)){
|
||||
$vendor_id2 = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
?>
|
||||
<option <?php if($vendor_id == $vendor_id2){ ?> selected <?php } ?> value="<?php echo $vendor_id2; ?>"><?php echo $vendor_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md">
|
||||
<label>Category</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-file"></i></span>
|
||||
</div>
|
||||
<select class="form-control" name="category" required>
|
||||
<?php
|
||||
|
||||
$sql2 = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Expense'");
|
||||
while($row = mysqli_fetch_array($sql2)){
|
||||
$category_id2 = $row['category_id'];
|
||||
$category_name = $row['category_name'];
|
||||
?>
|
||||
<option <?php if($category_id == $category_id2){ ?> selected <?php } ?> value="<?php echo $category_id2; ?>"><?php echo $category_name; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Description</label>
|
||||
<textarea class="form-control" rows="4" name="description" required><?php echo $expense_description; ?></textarea>
|
||||
</div>
|
||||
<div class="custom-file">
|
||||
<input type="file" class="custom-file-input" name="attachment">
|
||||
<label class="custom-file-label">Attach Reciept...</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_expense" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
122
expenses.php
122
expenses.php
|
|
@ -1,12 +1,18 @@
|
|||
<?php include("header.php"); ?>
|
||||
|
||||
<?php $sql = mysqli_query($mysqli,"SELECT * FROM expenses ORDER BY expense_id DESC"); ?>
|
||||
<?php
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM expenses, categories, vendors, accounts
|
||||
WHERE expenses.category_id = categories.category_id
|
||||
AND expenses.vendor_id = vendors.vendor_id
|
||||
AND expenses.account_id = accounts.account_id
|
||||
ORDER BY expenses.expense_date DESC");
|
||||
?>
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<i class="fas fa-table"></i>
|
||||
Expenses
|
||||
<button type="button" class="btn btn-primary btn-sm ml-4" data-toggle="modal" data-target="#addExpenseModal"><i class="fas fa-plus"></i> Add New</button>
|
||||
<h6 class="float-left mt-1"><i class="fa fa-money"></i> Expenses</h6>
|
||||
<button type="button" class="btn btn-primary btn-sm mr-auto float-right" data-toggle="modal" data-target="#addExpenseModal"><i class="fas fa-plus"></i> Add New</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
|
|
@ -28,103 +34,29 @@
|
|||
$expense_id = $row['expense_id'];
|
||||
$expense_date = $row['expense_date'];
|
||||
$expense_amount = $row['expense_amount'];
|
||||
$expense_description = $row['expense_description'];
|
||||
$vendor_id = $row['vendor_id'];
|
||||
$vendor_name = $row['vendor_name'];
|
||||
$expense_category = $row['expense_category'];
|
||||
$category_id = $row['category_id'];
|
||||
$category_name = $row['category_name'];
|
||||
$account_name = $row['account_name'];
|
||||
$account_id = $row['account_id'];
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo "$expense_date"; ?></td>
|
||||
<td><?php echo "$expense_date - $expense_id"; ?></td>
|
||||
<td class="text-right text-monospace">$<?php echo "$expense_amount"; ?></td>
|
||||
<td>Amazon</td>
|
||||
<td>Office Supplies</td>
|
||||
<td>PNC Bank</td>
|
||||
<td><?php echo "$vendor_name"; ?></td>
|
||||
<td><?php echo "$category_name"; ?></td>
|
||||
<td><?php echo "$account_name"; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#">Edit</a>
|
||||
<a class="dropdown-item" href="#">Duplicate</a>
|
||||
<a class="dropdown-item" href="#">Refund</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">15 Nov 2018</a></td>
|
||||
<td class="text-right text-monospace">$14.53</td>
|
||||
<td>Amazon</td>
|
||||
<td>Office Supplies</td>
|
||||
<td>PNC Bank</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-link btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#">Edit</a>
|
||||
<a class="dropdown-item" href="#">Duplicate</a>
|
||||
<a class="dropdown-item" href="#">Refund</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">15 Nov 2018</a></td>
|
||||
<td class="text-right text-monospace">$14.53</td>
|
||||
<td>Amazon</td>
|
||||
<td>Office Supplies</td>
|
||||
<td>PNC Bank</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-dark btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#">Edit</a>
|
||||
<a class="dropdown-item" href="#">Duplicate</a>
|
||||
<a class="dropdown-item" href="#">Refund</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">15 Nov 2018</a></td>
|
||||
<td class="text-right text-monospace">$14.53</td>
|
||||
<td>Amazon</td>
|
||||
<td>Office Supplies</td>
|
||||
<td>PNC Bank</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-light btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#">Edit</a>
|
||||
<a class="dropdown-item" href="#">Duplicate</a>
|
||||
<a class="dropdown-item" href="#">Refund</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="#">15 Nov 2018</a></td>
|
||||
<td class="text-right text-monospace">$1,014.53</td>
|
||||
<td>Amazon</td>
|
||||
<td>Office Supplies</td>
|
||||
<td>PNC Bank</td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#">Edit</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editExpenseModal<?php echo $expense_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="#">Duplicate</a>
|
||||
<a class="dropdown-item" href="#">Refund</a>
|
||||
<a class="dropdown-item" href="#">Delete</a>
|
||||
|
|
@ -132,6 +64,14 @@
|
|||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
include("edit_expense_modal.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -139,6 +79,6 @@
|
|||
<div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>
|
||||
</div>
|
||||
|
||||
<?php include("add_account_modal.php"); ?>
|
||||
<?php include("add_expense_modal.php"); ?>
|
||||
|
||||
<?php include("footer.php");
|
||||
86
post.php
86
post.php
|
|
@ -27,6 +27,27 @@ if(isset($_POST['add_client'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_client'])){
|
||||
|
||||
$client_id = intval($_POST['client_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$address = strip_tags(mysqli_real_escape_string($mysqli,$_POST['address']));
|
||||
$city = strip_tags(mysqli_real_escape_string($mysqli,$_POST['city']));
|
||||
$state = strip_tags(mysqli_real_escape_string($mysqli,$_POST['state']));
|
||||
$zip = strip_tags(mysqli_real_escape_string($mysqli,$_POST['zip']));
|
||||
$phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['phone']));
|
||||
$phone = preg_replace("/[^0-9]/", '',$phone);
|
||||
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
|
||||
$website = strip_tags(mysqli_real_escape_string($mysqli,$_POST['website']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE clients SET client_name = '$name', client_address = '$address', client_city = '$city', client_state = '$state', client_zip = '$zip', client_phone = '$phone', client_email = '$email', client_website = '$website', client_updated_at = UNIX_TIMESTAMP() WHERE client_id = $client_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Client updated";
|
||||
|
||||
header("Location: clients.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_vendor'])){
|
||||
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
|
|
@ -47,6 +68,27 @@ if(isset($_POST['add_vendor'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_vendor'])){
|
||||
|
||||
$vendor_id = intval($_POST['vendor_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$address = strip_tags(mysqli_real_escape_string($mysqli,$_POST['address']));
|
||||
$city = strip_tags(mysqli_real_escape_string($mysqli,$_POST['city']));
|
||||
$state = strip_tags(mysqli_real_escape_string($mysqli,$_POST['state']));
|
||||
$zip = strip_tags(mysqli_real_escape_string($mysqli,$_POST['zip']));
|
||||
$phone = strip_tags(mysqli_real_escape_string($mysqli,$_POST['phone']));
|
||||
$phone = preg_replace("/[^0-9]/", '',$phone);
|
||||
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
|
||||
$website = strip_tags(mysqli_real_escape_string($mysqli,$_POST['website']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE vendors SET vendor_name = '$name', vendor_address = '$address', vendor_city = '$city', vendor_state = '$state', vendor_zip = '$zip', vendor_phone = '$phone', vendor_email = '$email', vendor_website = '$website', vendor_updated_at = UNIX_TIMESTAMP() WHERE vendor_id = $vendor_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Vendor modified";
|
||||
|
||||
header("Location: vendors.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_mileage'])){
|
||||
|
||||
$date = strtotime($_POST['date']);
|
||||
|
|
@ -76,6 +118,50 @@ if(isset($_POST['add_account'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_category'])){
|
||||
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$type = strip_tags(mysqli_real_escape_string($mysqli,$_POST['type']));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO categories SET category_name = '$name', category_type = '$type'");
|
||||
|
||||
$_SESSION['alert_message'] = "Category added";
|
||||
|
||||
header("Location: categories.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_category'])){
|
||||
|
||||
$category_id = intval($_POST['category_id']);
|
||||
$name = strip_tags(mysqli_real_escape_string($mysqli,$_POST['name']));
|
||||
$type = strip_tags(mysqli_real_escape_string($mysqli,$_POST['type']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE categories SET category_name = '$name', category_type = '$type' WHERE category_id = $category_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Category modified";
|
||||
|
||||
header("Location: categories.php");
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_expense'])){
|
||||
|
||||
$date = strip_tags(mysqli_real_escape_string($mysqli,$_POST['date']));
|
||||
$amount = $_POST['amount'];
|
||||
$account = intval($_POST['account']);
|
||||
$vendor = intval($_POST['vendor']);
|
||||
$category = intval($_POST['category']);
|
||||
$description = strip_tags(mysqli_real_escape_string($mysqli,$_POST['description']));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO expenses SET expense_date = '$date', expense_amount = '$amount', account_id = $account, vendor_id = $vendor, category_id = $category, expense_description = '$description'");
|
||||
|
||||
$_SESSION['alert_message'] = "Expense added";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_user'])){
|
||||
$email = strip_tags(mysqli_real_escape_string($mysqli,$_POST['email']));
|
||||
$password = mysqli_real_escape_string($mysqli,$_POST['password']);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="vendors.php">
|
||||
<i class="fas fa-fw fa-user-tie"></i>
|
||||
<i class="fas fa-fw fa-briefcase"></i>
|
||||
<span>Vendors</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="pagesDropdown">
|
||||
<a class="dropdown-item" href="settings-general.php">General</a>
|
||||
<a class="dropdown-item" href="forgot-password.html">Categories</a>
|
||||
<a class="dropdown-item" href="categories.php">Categories</a>
|
||||
<a class="dropdown-item" href="forgot-password.html">Users</a>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue