mirror of https://github.com/itflow-org/itflow
started work on guest invoice view using a url key
This commit is contained in:
parent
f1ee97670c
commit
9bf60deeb9
|
|
@ -64,7 +64,7 @@
|
|||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="add_calendar_event" class="btn btn-primary">Save</button>
|
||||
<button type="submit" name="add_event" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,95 +6,9 @@ if(isset($_GET['calendar_id'])){
|
|||
$calendar_selected_id = intval($_GET['calendar_id']);
|
||||
}
|
||||
|
||||
//Get Calendar list for the select box
|
||||
$sql_calendars = mysqli_query($mysqli,"SELECT * FROM calendars ORDER BY calendar_name DESC");
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendars, calendar_events WHERE calendars.calendar_id = calendar_events.calendar_id AND calendar_events.calendar_id LIKE '%$calendar_selected_id%' ORDER BY calendar_event_id DESC");
|
||||
|
||||
?>
|
||||
|
||||
<div id='calendar'></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h5 class="float-left mt-2"><i class="fa fa-calendar mr-2"></i>Events</h5>
|
||||
<button type="button" class="btn btn-primary badge-pill mr-auto float-right" data-toggle="modal" data-target="#addCalendarEventModal"><i class="fas fa-fw fa-calendar-plus"></i></button>
|
||||
<form>
|
||||
<select onchange="this.form.submit()" class="form-control mt-5" name="calendar_id">
|
||||
<option value="">- ALL Calendars -</option>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql_calendars)){
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = $row['calendar_name'];
|
||||
?>
|
||||
<option <?php if($calendar_id == $calendar_selected_id){ ?> selected <?php } ?> value="<?php echo $calendar_id; ?>"> <?php echo $calendar_name; ?></option>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</select>
|
||||
</form>
|
||||
</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 class="thead-dark">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Times</th>
|
||||
<th>Title</th>
|
||||
<th>Calendar</th>
|
||||
<th class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$calendar_event_id = $row['calendar_event_id'];
|
||||
$calendar_event_title = $row['calendar_event_title'];
|
||||
$calendar_event_start = $row['calendar_event_start'];
|
||||
$calendar_event_end = $row['calendar_event_end'];
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = $row['calendar_name'];
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo date( 'm/d/y', strtotime($calendar_event_start)); ?></td>
|
||||
<td><?php echo date( 'g:i A', strtotime($calendar_event_start)); ?> - <?php echo date( 'g:i A', strtotime($calendar_event_end)); ?></td>
|
||||
<td><?php echo $calendar_event_title; ?></td>
|
||||
<td><?php echo $calendar_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="#" data-toggle="modal" data-target="#editCalendarEventModal<?php echo $calendar_event_id; ?>">Edit</a>
|
||||
<a class="dropdown-item" href="post.php?delete_calendar_event=<?php echo $calendar_event_id; ?>">Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
include("edit_calendar_event_modal.php");
|
||||
}
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='calendar'></div>
|
||||
|
||||
<?php include("add_calendar_event_modal.php"); ?>
|
||||
|
||||
|
|
@ -108,25 +22,36 @@ $sql = mysqli_query($mysqli,"SELECT * FROM calendars, calendar_events WHERE cale
|
|||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
|
||||
defaultView: 'dayGridMonth',
|
||||
customButtons: {
|
||||
myCustomButton: {
|
||||
text: 'New',
|
||||
click: function() {
|
||||
$("#addCalendarEventModal").modal("show");
|
||||
}
|
||||
}
|
||||
},
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth'
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth myCustomButton'
|
||||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendar_events");
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM events");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$calendar_event_id = $row['calendar_event_id'];
|
||||
$calendar_event_title = $row['calendar_event_title'];
|
||||
$calendar_event_start = $row['calendar_event_start'];
|
||||
$calendar_event_end = $row['calendar_event_end'];
|
||||
$event_id = $row['event_id'];
|
||||
$event_title = $row['event_title'];
|
||||
$event_start = $row['event_start'];
|
||||
$event_end = $row['event_end'];
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = $row['calendar_name'];
|
||||
echo "{ title: '$calendar_event_title', start: '$calendar_event_start' },";
|
||||
echo "{ id: '$event_id', title: '$event_title', start: '$event_start'},";
|
||||
}
|
||||
?>
|
||||
]
|
||||
],
|
||||
eventClick: function(calEvent, jsEvent, view, resourceObj) {
|
||||
$("#addCalendarEventModal").modal("show");
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
<?php include("header.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
if(isset($_GET['calendar_id'])){
|
||||
$calendar_selected_id = intval($_GET['calendar_id']);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<nav class="nav flex-column mb-5">
|
||||
<h2 class="text-center">Calendars</h2>
|
||||
<a class="btn btn-primary btn-block" href="#">New Event</a>
|
||||
<a class="nav-link active" href="#">Jobs</a>
|
||||
<a class="nav-link" href="#">Domains</a>
|
||||
<a class="nav-link" href="#">Clients</a>
|
||||
<a class="nav-link" href="#">Invoices</a>
|
||||
<a class="nav-link" href="#">Recurring</a>
|
||||
<a class="nav-link" href="#">Payments</a>
|
||||
<a class="nav-link" href="#">Trips</a>
|
||||
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Expenses</a>
|
||||
</nav>
|
||||
<form>
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" name="calendar" placeholder="Calendar name">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary btn-sm" type="button"><i class="fa fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<div id='calendar'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include("add_calendar_event_modal.php"); ?>
|
||||
|
||||
<?php include("footer.php"); ?>
|
||||
|
||||
<script>
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
plugins: [ 'interaction', 'dayGrid', 'timeGrid', 'list' ],
|
||||
defaultView: 'dayGridMonth',
|
||||
customButtons: {
|
||||
myCustomButton: {
|
||||
text: 'New',
|
||||
click: function() {
|
||||
$("#addCalendarEventModal").modal("show");
|
||||
}
|
||||
}
|
||||
},
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth myCustomButton'
|
||||
},
|
||||
events: [
|
||||
<?php
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM calendar_events");
|
||||
while($row = mysqli_fetch_array($sql)){
|
||||
$calendar_event_id = $row['calendar_event_id'];
|
||||
$calendar_event_title = $row['calendar_event_title'];
|
||||
$calendar_event_start = $row['calendar_event_start'];
|
||||
$calendar_event_end = $row['calendar_event_end'];
|
||||
$calendar_id = $row['calendar_id'];
|
||||
$calendar_name = $row['calendar_name'];
|
||||
echo "{ id: '$calendar_event_id', title: '$calendar_event_title', start: '$calendar_event_start'},";
|
||||
}
|
||||
?>
|
||||
],
|
||||
eventClick: function(calEvent, jsEvent, view, resourceObj) {
|
||||
$("#addCalendarEventModal").modal("show");
|
||||
}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
<?php
|
||||
|
||||
|
||||
function roundUpToNearestMultiple($n, $increment = 1000)
|
||||
{
|
||||
return (int) ($increment * ceil($n / $increment));
|
||||
|
|
@ -109,7 +108,7 @@ $sql_latest_expenses = mysqli_query($mysqli,"SELECT * FROM expenses, vendors, ca
|
|||
<div class="card mb-3">
|
||||
<div class="card-header"><i class="fas fa-fw fa-chart-area"></i> Cash Flow</div>
|
||||
<div class="card-body">
|
||||
<canvas id="myAreaChart" width="100%" height="25"></canvas>
|
||||
<canvas id="myAreaChart" width="100%" height="20"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
<div class="modal" id="editCalendarEventModal<?php echo $calendar_event_id; ?>" tabindex="-1">
|
||||
<div class="modal" id="editCalendarEventModal<?php echo $event_id; ?>" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-calendar mr-2"></i><?php echo $calendar_event_title; ?></h5>
|
||||
<h5 class="modal-title text-white"><i class="fa fa-fw fa-calendar mr-2"></i><?php echo $event_title; ?></h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="calendar_event_id" value="<?php echo $calendar_event_id; ?>">
|
||||
<input type="hidden" name="event_id" value="<?php echo $event_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
<div class="form-group">
|
||||
<label>Title</label>
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
|
||||
</div>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title of the event" value="<?php echo $calendar_event_title; ?>" required>
|
||||
<input type="text" class="form-control" name="title" placeholder="Title of the event" value="<?php echo $event_title; ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-clock"></i></span>
|
||||
</div>
|
||||
<input type="datetime-local" class="form-control" name="start" value="<?php echo date('Y-m-d\TH:i:s', strtotime($calendar_event_start)); ?>" required>
|
||||
<input type="datetime-local" class="form-control" name="start" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_start)); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
|
|
@ -57,14 +57,14 @@
|
|||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-stopwatch"></i></span>
|
||||
</div>
|
||||
<input type="datetime-local" class="form-control" name="end" value="<?php echo date('Y-m-d\TH:i:s', strtotime($calendar_event_end)); ?>" required>
|
||||
<input type="datetime-local" class="form-control" name="end" value="<?php echo date('Y-m-d\TH:i:s', strtotime($event_end)); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="submit" name="edit_calendar_event" class="btn btn-primary">Save</button>
|
||||
<button type="submit" name="edit_event" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
<script src='vendor/fullcalendar/daygrid/main.min.js'></script>
|
||||
<script src='vendor/fullcalendar/timegrid/main.min.js'></script>
|
||||
<script src='vendor/fullcalendar/list/main.min.js'></script>
|
||||
<script src='vendor/fullcalendar/interaction/main.min.js'></script>
|
||||
|
||||
<!-- Custom scripts for all pages-->
|
||||
<script src="js/sb-admin.min.js"></script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
|
||||
</div>
|
||||
<!-- /.content-wrapper -->
|
||||
|
||||
</div>
|
||||
<!-- /#wrapper -->
|
||||
|
||||
<!-- Scroll to Top Button-->
|
||||
<a class="scroll-to-top rounded" href="#page-top">
|
||||
<i class="fas fa-angle-up"></i>
|
||||
</a>
|
||||
|
||||
<!-- Bootstrap core JavaScript-->
|
||||
<script src="vendor/jquery/jquery.min.js"></script>
|
||||
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<!-- Core plugin JavaScript-->
|
||||
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
|
||||
|
||||
<!-- Custom scripts for all pages-->
|
||||
<script src="js/sb-admin.min.js"></script>
|
||||
|
||||
<!-- Custom js-->
|
||||
<script src="js/app.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
include("config.php");
|
||||
include("functions.php");
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title><?php echo $config_company_name; ?></title>
|
||||
|
||||
<!-- Custom fonts for this template-->
|
||||
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Custom styles for this template-->
|
||||
<link href="css/sb-admin.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Custom Style Sheet -->
|
||||
<link href="css/style.css" rel="stylesheet" type="text/css">
|
||||
|
||||
</head>
|
||||
|
||||
<body id="page-top">
|
||||
|
||||
<div id="wrapper">
|
||||
|
||||
<div id="content-wrapper">
|
||||
|
||||
<div class="container-fluid">
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
<?php include("guest_header.php"); ?>
|
||||
|
||||
<?php
|
||||
|
||||
if(isset($_GET['invoice_id'], $_GET['url_key'])){
|
||||
|
||||
$url_key = $_GET['url_key'];
|
||||
$invoice_id = intval($_GET['invoice_id']);
|
||||
|
||||
$sql = mysqli_query($mysqli,"SELECT * FROM invoices, clients
|
||||
WHERE invoices.client_id = clients.client_id
|
||||
AND invoices.invoice_id = $invoice_id
|
||||
AND invoices.invoice_url_key = '$url_key'"
|
||||
);
|
||||
|
||||
$row = mysqli_fetch_array($sql);
|
||||
$invoice_id = $row['invoice_id'];
|
||||
$invoice_number = $row['invoice_number'];
|
||||
$invoice_status = $row['invoice_status'];
|
||||
$invoice_date = $row['invoice_date'];
|
||||
$invoice_due = $row['invoice_due'];
|
||||
$invoice_amount = $row['invoice_amount'];
|
||||
$invoice_note = $row['invoice_note'];
|
||||
$invoice_category_id = $row['category_id'];
|
||||
$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'];
|
||||
$client_net_terms = $row['client_net_terms'];
|
||||
if($client_net_terms == 0){
|
||||
$client_net_terms = $config_default_net_terms;
|
||||
}
|
||||
|
||||
if(mysqli_num_rows($sql) == 1){
|
||||
|
||||
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments, accounts WHERE payments.account_id = accounts.account_id AND payments.invoice_id = $invoice_id ORDER BY payments.payment_id DESC");
|
||||
|
||||
//Add up all the payments for the invoice and get the total amount paid to the invoice
|
||||
$sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE invoice_id = $invoice_id");
|
||||
$row = mysqli_fetch_array($sql_amount_paid);
|
||||
$amount_paid = $row['amount_paid'];
|
||||
|
||||
$balance = $invoice_amount - $amount_paid;
|
||||
|
||||
//check to see if overdue
|
||||
|
||||
$unixtime_invoice_due = strtotime($invoice_due);
|
||||
if($unixtime_invoice_due < time()){
|
||||
$invoice_status = "Overdue";
|
||||
$invoice_color = "text-danger";
|
||||
}
|
||||
|
||||
//Set Badge color based off of invoice status
|
||||
if($invoice_status == "Sent"){
|
||||
$invoice_badge_color = "warning text-white";
|
||||
}elseif($invoice_status == "Partial"){
|
||||
$invoice_badge_color = "primary";
|
||||
}elseif($invoice_status == "Paid"){
|
||||
$invoice_badge_color = "success";
|
||||
}elseif($invoice_status == "Cancelled"){
|
||||
$invoice_badge_color = "danger";
|
||||
}else{
|
||||
$invoice_badge_color = "secondary";
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<div class="row d-print-none">
|
||||
<div class="col-md-6">
|
||||
<h2>Invoice <?php echo $invoice_number; ?></h2>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary" href="#" onclick="window.print();">Print</a>
|
||||
<a class="btn btn-primary" href="post.php?pdf_invoice=<?php echo $invoice_id; ?>">PDF</a>
|
||||
<?php
|
||||
if($invoice_status != "Paid" or $invoice_status != "Cancelled" or $invoice_status != "Draft"){
|
||||
?>
|
||||
<a class="btn btn-primary" href="post.php?pdf_invoice=<?php echo $invoice_id; ?>">Pay</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-sm">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
From
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-unstyled">
|
||||
<li><strong><?php echo $config_company_name; ?></strong></li>
|
||||
<li><?php echo $config_company_address; ?></li>
|
||||
<li class="mb-3"><?php echo "$config_company_city $config_company_state $config_company_zip"; ?></li>
|
||||
<li><?php echo $config_company_phone; ?></li>
|
||||
<li><?php echo $config_company_email; ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Bill To
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-unstyled">
|
||||
<li><strong><?php echo $client_name; ?></strong></li>
|
||||
<li><?php echo $client_address; ?></li>
|
||||
<li class="mb-3"><?php echo "$client_city $client_state $client_zip"; ?></li>
|
||||
<li><?php echo $client_phone; ?></li>
|
||||
<li><?php echo $client_email; ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Details
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-unstyled">
|
||||
<li class="mb-1"><strong>Invoice Number:</strong> <div class="float-right">INV-<?php echo $invoice_number; ?></div></li>
|
||||
<li class="mb-1"><strong>Invoice Date:</strong> <div class="float-right"><?php echo $invoice_date; ?></div></li>
|
||||
<li><strong>Payment Due:</strong> <div class="float-right <?php echo $invoice_color; ?>"><?php echo $invoice_due; ?></div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY item_id ASC"); ?>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Items
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Product</th>
|
||||
<th>Description</th>
|
||||
<th class="text-center">Qty</th>
|
||||
<th class="text-right">Price</th>
|
||||
<th class="text-right">Tax</th>
|
||||
<th class="text-right">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while($row = mysqli_fetch_array($sql_invoice_items)){
|
||||
$item_id = $row['item_id'];
|
||||
$item_name = $row['item_name'];
|
||||
$item_description = $row['item_description'];
|
||||
$item_quantity = $row['item_quantity'];
|
||||
$item_price = $row['item_price'];
|
||||
$item_subtotal = $row['item_price'];
|
||||
$item_tax = $row['item_tax'];
|
||||
$item_total = $row['item_total'];
|
||||
$total_tax = $item_tax + $total_tax;
|
||||
$sub_total = $item_price * $item_quantity + $sub_total;
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $item_name; ?></td>
|
||||
<td><?php echo $item_description; ?></td>
|
||||
<td class="text-center"><?php echo $item_quantity; ?></td>
|
||||
<td class="text-right text-monospace">$<?php echo number_format($item_price,2); ?></td>
|
||||
<td class="text-right text-monospace">$<?php echo number_format($item_tax,2); ?></td>
|
||||
<td class="text-right text-monospace">$<?php echo number_format($item_total,2); ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-7">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Notes
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-none d-print-block"><?php echo $invoice_note; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 offset-2">
|
||||
<table class="table table-borderless">
|
||||
<tbody>
|
||||
<tr class="border-bottom">
|
||||
<td>Subtotal</td>
|
||||
<td class="text-right text-monospace">$<?php echo number_format($sub_total,2); ?></td>
|
||||
</tr>
|
||||
<?php if($discount > 0){ ?>
|
||||
<tr class="border-bottom">
|
||||
<td>Discount</td>
|
||||
<td class="text-right text-monospace">$<?php echo number_format($invoice_discount,2); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if($total_tax > 0){ ?>
|
||||
<tr class="border-bottom">
|
||||
<td>Tax</td>
|
||||
<td class="text-right text-monospace">$<?php echo number_format($total_tax,2); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if($amount_paid > 0){ ?>
|
||||
<tr class="border-bottom">
|
||||
<td><div class="text-success">Paid to Date</div></td>
|
||||
<td class="text-right text-monospace text-success">$<?php echo number_format($amount_paid,2); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr class="border-bottom">
|
||||
<td><strong>Balance Due</strong></td>
|
||||
<td class="text-right text-monospace"><strong>$<?php echo number_format($balance,2); ?></strong></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
}else{
|
||||
echo "GTFO";
|
||||
}
|
||||
}else{
|
||||
echo "GTFO";
|
||||
} ?>
|
||||
|
||||
<?php include("guest_footer.php"); ?>
|
||||
16
post.php
16
post.php
|
|
@ -284,14 +284,14 @@ if(isset($_GET['delete_client'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['add_calendar_event'])){
|
||||
if(isset($_POST['add_event'])){
|
||||
|
||||
$calendar_id = intval($_POST['calendar']);
|
||||
$title = strip_tags(mysqli_real_escape_string($mysqli,$_POST['title']));
|
||||
$start = strip_tags(mysqli_real_escape_string($mysqli,$_POST['start']));
|
||||
$end = strip_tags(mysqli_real_escape_string($mysqli,$_POST['end']));
|
||||
|
||||
mysqli_query($mysqli,"INSERT INTO calendar_events SET calendar_event_title = '$title', calendar_event_start = '$start', calendar_event_end = '$end', calendar_id = $calendar_id");
|
||||
mysqli_query($mysqli,"INSERT INTO events SET event_title = '$title', event_start = '$start', event_end = '$end', calendar_id = $calendar_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Event added to the calendar";
|
||||
|
||||
|
|
@ -299,15 +299,15 @@ if(isset($_POST['add_calendar_event'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_POST['edit_calendar_event'])){
|
||||
if(isset($_POST['edit_event'])){
|
||||
|
||||
$calendar_event_id = intval($_POST['calendar_event_id']);
|
||||
$event_id = intval($_POST['event_id']);
|
||||
$calendar_id = intval($_POST['calendar']);
|
||||
$title = strip_tags(mysqli_real_escape_string($mysqli,$_POST['title']));
|
||||
$start = strip_tags(mysqli_real_escape_string($mysqli,$_POST['start']));
|
||||
$end = strip_tags(mysqli_real_escape_string($mysqli,$_POST['end']));
|
||||
|
||||
mysqli_query($mysqli,"UPDATE calendar_events SET calendar_event_title = '$title', calendar_event_start = '$start', calendar_event_end = '$end', calendar_id = $calendar_id WHERE calendar_event_id = $calendar_event_id");
|
||||
mysqli_query($mysqli,"UPDATE events SET event_title = '$title', event_start = '$start', event_end = '$end', calendar_id = $calendar_id WHERE event_id = $event_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Event modified on the calendar";
|
||||
|
||||
|
|
@ -315,10 +315,10 @@ if(isset($_POST['edit_calendar_event'])){
|
|||
|
||||
}
|
||||
|
||||
if(isset($_GET['delete_calendar_event'])){
|
||||
$calendar_event_id = intval($_GET['delete_calendar_event']);
|
||||
if(isset($_GET['delete_event'])){
|
||||
$event_id = intval($_GET['delete_calendar_event']);
|
||||
|
||||
mysqli_query($mysqli,"DELETE FROM calendar_events WHERE calendar_event_id = $calendar_event_id");
|
||||
mysqli_query($mysqli,"DELETE FROM events WHERE event_id = $event_id");
|
||||
|
||||
$_SESSION['alert_message'] = "Event deleted on the calendar";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue