| DIR: /home/islapiiu/sites/shiny/admin/ |
| Current File : /home/islapiiu/sites/shiny/admin/invoice-report.php |
<?php
include_once(dirname(__FILE__) . '/../class/include.php');
include_once(dirname(__FILE__) . '/auth.php');
$INVOICE = New Invoice(NULL);
$result = NULL;
if (isset($_GET['submit'])) {
$date_from = $_GET['date_from'];
$date_to = $_GET['date_to'];
$invoice = $_GET['invoice'];
$result = $INVOICE->filter($date_from, $date_to, $invoice);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<title>Invoice Manager || Invoice Manager</title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
<link href="plugins/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="plugins/node-waves/waves.css" rel="stylesheet" />
<link href="plugins/animate-css/animate.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet">
<link href="css/themes/all-themes.css" rel="stylesheet" />
<link href="plugins/sweetalert/sweetalert.css" rel="stylesheet" />
</head>
<body class="theme-red">
<?php
include './navigation-and-header.php';
?>
<section class="content">
<div class="container-fluid">
<?php
if (isset($_GET['message'])) {
$MESSAGE = New Message($_GET['message']);
?>
<div class="alert alert-<?php echo $MESSAGE->status; ?>" role = "alert">
<?php echo $MESSAGE->description; ?>
</div>
<?php
}
?>
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<div class="header">
<h2>
Invoice Report
</h2>
</div>
<div class="body row">
<form class="form-horizontal col-sm-12 col-md-12" method="get">
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-6 form-control-label">
<label for="date_from">Date From</label>
</div>
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-6">
<div class="form-group">
<div class="form-line">
<input type="date" id="date_from" name="date_from" class="form-control">
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-6 col-xs-6 form-control-label">
<label for="date_to">Date to</label>
</div>
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-6">
<div class="form-group">
<div class="form-line">
<input type="date" id="date_to" name="date_to" class="form-control">
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-6 col-xs-6 form-control-label">
<label for="invoice">Invoice</label>
</div>
<div class="col-lg-2 col-md-2 col-sm-6 col-xs-6">
<div class="form-group">
<div class="form-line">
<input type="text" id="invoice" name="invoice" class="form-control">
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-12 form-control-label text-left">
<input type="submit" name="submit" class="btn btn-info" id="btn-submit" value="submit">
</div>
</div>
</form>
</div>
<div class="body row">
<div class="col-sm-12 col-md-12" >
<div id="DivIdToPrint">
<table class="table table-responsive table-striped">
<tr>
<th>#</th>
<th>Invoice</th>
<th>Date</th>
<th>Customer</th>
<th>Function Date</th>
<th>Invoice Total</th>
</tr>
<?php
$total = 0;
foreach ($result as $key => $invoice) {
?>
<tr>
<td><?php echo $key; ?></td>
<td>#<?php echo sprintf("%06d", $invoice['id']); ?></td>
<td><?php echo $invoice['date']; ?></td>
<td><?php echo $invoice['customer']; ?></td>
<td><?php echo $invoice['function_date']; ?></td>
<td class="text-right">
<?php
$II = new InvoiceItem(NULL);
$II->invoice = $invoice['id'];
echo number_format($II->getTotalByInvoice(), 2);
$total = $total + $II->getTotalByInvoice();
?>
</td>
</tr>
<?php
}
?>
<tr>
<th colspan="5" class="text-right">Total</th>
<th class="text-right"><?php echo number_format($total, 2); ?></th>
</tr>
</table>
</div>
<div class="text-center hidden-print">
<br/>
<br/>
<a class="btn btn-success" target="_blank" onclick='printDiv();'><i class="glyphicon glyphicon-print"></i> : Print This Invoice</a>
<br/>
<br/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Jquery Core Js -->
<script src="plugins/jquery/jquery.min.js"></script>
<script src="plugins/bootstrap/js/bootstrap.js"></script>
<script src="plugins/bootstrap-select/js/bootstrap-select.js"></script>
<script src="plugins/jquery-slimscroll/jquery.slimscroll.js"></script>
<script src="plugins/node-waves/waves.js"></script>
<script src="plugins/sweetalert/sweetalert.min.js"></script>
<script src="js/admin.js"></script>
<script src="js/demo.js"></script>
<script type="text/javascript">
function printDiv()
{
var divToPrint = document.getElementById('DivIdToPrint');
var newWin = window.open('', 'Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()"><link href="plugins/bootstrap/css/bootstrap.css" rel="stylesheet">' + divToPrint.innerHTML + '</body></html>');
newWin.document.close();
setTimeout(function () {
newWin.close();
}, 10);
}
</script>
</body>
</html> |